1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-05 14:23:30 +01:00
bitwarden-server/test/Icons.Test/Services/IconFetchingServiceTests.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.0 KiB
C#
Raw Normal View History

using Bit.Icons.Services;
using Xunit;
namespace Bit.Icons.Test.Services;
2022-08-29 22:06:55 +02:00
public class IconFetchingServiceTests : ServiceTestBase<IconFetchingService>
{
[Theory(Skip = "Run ad-hoc")]
[InlineData("www.twitter.com")] // https site
[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")]
[InlineData("icloud.com")]
public async Task GetIconAsync_Success(string domain)
2022-08-29 20:53:16 +02:00
{
var sut = BuildSut();
var result = await sut.GetIconAsync(domain);
2022-08-29 20:53:16 +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)
2022-08-29 22:06:55 +02:00
{
var sut = BuildSut();
var result = await sut.GetIconAsync(domain);
2022-08-29 22:06:55 +02:00
Assert.Null(result);
2022-08-29 22:06:55 +02:00
}
private IconFetchingService BuildSut() =>
GetService<IconFetchingService>();
}