1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-11 15:17:44 +01:00
bitwarden-server/test/Icons.Test/Services/IconFetchingServiceTests.cs

39 lines
1.0 KiB
C#
Raw Normal View History

using Bit.Icons.Services;
using Xunit;
2022-08-29 22:06:55 +02:00
namespace Bit.Icons.Test.Services;
public class IconFetchingServiceTests : ServiceTestBase<IconFetchingService>
{
[Theory(Skip = "Run ad-hoc")]
[InlineData("www.twitter.com")] // https site
2022-08-29 22:06:55 +02:00
[InlineData("www.google.com")] // https site
[InlineData("neverssl.com")] // http site
[InlineData("neopets.com")] // uses favicon.ico
[InlineData("hopin.com")] // uses svg+xml format
[InlineData("tdameritrade.com")]
2022-08-29 22:06:55 +02:00
[InlineData("icloud.com")]
public async Task GetIconAsync_Success(string domain)
2022-08-29 20:53:16 +02:00
{
var sut = BuildSut();
2022-08-29 22:06:55 +02:00
var result = await sut.GetIconAsync(domain);
2022-08-29 20:53:16 +02:00
2022-08-29 22:06:55 +02:00
Assert.NotNull(result);
}
2022-08-29 20:53:16 +02:00
2022-08-29 22:06:55 +02:00
[Theory]
[InlineData("1.1.1.1")]
[InlineData("")]
[InlineData("localhost")]
public async Task GetIconAsync_ReturnsNull(string domain)
{
var sut = BuildSut();
2022-08-29 22:06:55 +02:00
var result = await sut.GetIconAsync(domain);
Assert.Null(result);
}
private IconFetchingService BuildSut() =>
GetService<IconFetchingService>();
}