diff --git a/Tests/LibMatrix.Tests/Config.cs b/Tests/LibMatrix.Tests/Config.cs
index 045ea40..b59b238 100644
--- a/Tests/LibMatrix.Tests/Config.cs
+++ b/Tests/LibMatrix.Tests/Config.cs
@@ -18,7 +18,7 @@ public class Config {
{ "matrix.org", "https://matrix-client.matrix.org" },
{ "rory.gay", "https://matrix.rory.gay" },
{ "feline.support", "https://matrix.feline.support" },
- { "transfem.dev", "https://matrix.transfem.dev" },
+ { "transfem.dev", "https://matrix.transfem.dev/" },
{ "the-apothecary.club", "https://the-apothecary.club" },
{ "nixos.org", "https://matrix.nixos.org" },
{ "fedora.im", "https://fedora.ems.host" }
diff --git a/Tests/LibMatrix.Tests/Tests/HomeserverResolverTests/ClientWellKnownResolverTests.cs b/Tests/LibMatrix.Tests/Tests/HomeserverResolverTests/ClientWellKnownResolverTests.cs
new file mode 100644
index 0000000..f6dfd97
--- /dev/null
+++ b/Tests/LibMatrix.Tests/Tests/HomeserverResolverTests/ClientWellKnownResolverTests.cs
@@ -0,0 +1,41 @@
+using LibMatrix.Services;
+using LibMatrix.Services.WellKnownResolvers;
+using LibMatrix.Tests.Fixtures;
+using Xunit.Abstractions;
+using Xunit.Microsoft.DependencyInjection.Abstracts;
+
+namespace LibMatrix.Tests.Tests.HomeserverResolverTests;
+
+public class ClientWellKnownResolverTests : TestBed<TestFixture> {
+ private readonly Config _config;
+ private readonly ClientWellKnownResolver _resolver;
+
+ public ClientWellKnownResolverTests(ITestOutputHelper testOutputHelper, TestFixture fixture) : base(testOutputHelper, fixture) {
+ _config = _fixture.GetService<Config>(_testOutputHelper) ?? throw new InvalidOperationException($"Failed to get {nameof(Config)}");
+ _resolver = _fixture.GetService<ClientWellKnownResolver>(_testOutputHelper) ?? throw new InvalidOperationException($"Failed to get {nameof(HomeserverResolverService)}");
+ }
+
+ [Fact]
+ public async Task ResolveServerClient() {
+ var tasks = _config.ExpectedHomeserverClientMappings.Select(async mapping => {
+ var server = await _resolver.TryResolveClientWellKnown(mapping.Key);
+ Assert.Equal(mapping.Value, server.WellKnown.Homeserver.BaseUrl);
+ return server;
+ }).ToList();
+ await Task.WhenAll(tasks);
+ }
+
+ private async Task AssertClientWellKnown(string homeserver, string expected) {
+ var server = await _resolver.TryResolveClientWellKnown(homeserver);
+ Assert.Equal(expected, server.WellKnown.Homeserver.BaseUrl);
+ }
+
+ [Fact]
+ public Task ResolveMatrixOrg() => AssertClientWellKnown("matrix.org", "https://matrix-client.matrix.org");
+
+ [Fact]
+ public Task ResolveRoryGay() => AssertClientWellKnown("rory.gay", "https://matrix.rory.gay");
+
+ [Fact]
+ public Task ResolveTransfemDev() => AssertClientWellKnown("transfem.dev", "https://matrix.transfem.dev/");
+}
\ No newline at end of file
diff --git a/Tests/LibMatrix.Tests/Tests/HomeserverResolverTests.cs b/Tests/LibMatrix.Tests/Tests/LegacyHomeserverResolverTests.cs
index 7226fe9..20dc4fb 100644
--- a/Tests/LibMatrix.Tests/Tests/HomeserverResolverTests.cs
+++ b/Tests/LibMatrix.Tests/Tests/LegacyHomeserverResolverTests.cs
@@ -5,11 +5,11 @@ using Xunit.Microsoft.DependencyInjection.Abstracts;
namespace LibMatrix.Tests.Tests;
-public class HomeserverResolverTests : TestBed<TestFixture> {
+public class LegacyHomeserverResolverTests : TestBed<TestFixture> {
private readonly Config _config;
private readonly HomeserverResolverService _resolver;
- public HomeserverResolverTests(ITestOutputHelper testOutputHelper, TestFixture fixture) : base(testOutputHelper, fixture) {
+ public LegacyHomeserverResolverTests(ITestOutputHelper testOutputHelper, TestFixture fixture) : base(testOutputHelper, fixture) {
_config = _fixture.GetService<Config>(_testOutputHelper) ?? throw new InvalidOperationException($"Failed to get {nameof(Config)}");
_resolver = _fixture.GetService<HomeserverResolverService>(_testOutputHelper) ?? throw new InvalidOperationException($"Failed to get {nameof(HomeserverResolverService)}");
}
|