1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-27 17:47:37 +01:00
bitwarden-server/test/Icons.Test/Services/IconFetchingServiceTests.cs
Matt Bishop ae1fdb0992
[PM-5052] Upgrade to .NET 8 (#3461)
* Upgrade to .NET 8

* Linting

* Clean up old JSON deserialization code

* More .NET 8-oriented linting

* Light feedback

* Get rid of old test we don't know the root issue for

* Fix a new test

* Remove now-unnecessary Renovate constraint

* Use Any()

* Somehow a 6.0 tooling config we don't need snuck back in

* Space out properties that always change per release

* Bump a few core packages since the last update
2024-02-05 13:03:42 -05:00

39 lines
1.1 KiB
C#

using Bit.Icons.Services;
using Xunit;
namespace Bit.Icons.Test.Services;
public class IconFetchingServiceTests : ServiceTestBase<IconFetchingService>
{
[Theory]
[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("ameritrade.com")] // redirects to tdameritrade.com
[InlineData("icloud.com")]
public async Task GetIconAsync_Success(string domain)
{
var sut = BuildSut();
var result = await sut.GetIconAsync(domain);
Assert.NotNull(result);
}
[Theory]
[InlineData("1.1.1.1")]
[InlineData("")]
[InlineData("localhost")]
public async Task GetIconAsync_ReturnsNull(string domain)
{
var sut = BuildSut();
var result = await sut.GetIconAsync(domain);
Assert.Null(result);
}
private IconFetchingService BuildSut() =>
GetService<IconFetchingService>();
}