diff --git a/app/src/test/java/com/vitorpamplona/amethyst/service/Nip05VerifierTest.kt b/app/src/test/java/com/vitorpamplona/amethyst/service/Nip05VerifierTest.kt index 52f8e5c6e..44d964ec8 100644 --- a/app/src/test/java/com/vitorpamplona/amethyst/service/Nip05VerifierTest.kt +++ b/app/src/test/java/com/vitorpamplona/amethyst/service/Nip05VerifierTest.kt @@ -6,6 +6,7 @@ import io.mockk.impl.annotations.SpyK import io.mockk.unmockkAll import org.junit.After import org.junit.Assert.assertEquals +import org.junit.Assert.assertNull import org.junit.Assert.fail import org.junit.Before import org.junit.Test @@ -90,4 +91,31 @@ class Nip05VerifierTest { fun tearDown() { unmockkAll() } + + @Test + fun `test assmble url with invalid value returns null`() { + // given + val nip05address = "this@that@that.com" + + // when + val actualValue = nip05Verifier.assembleUrl(nip05address) + + // then + assertNull(actualValue) + } + + @Test + fun `test assmble url with valid value returns user url`() { + // given + val userName = "TheUser" + val domain = "domain.com" + val nip05address = "$userName@$domain" + val expectedValue = "https://$domain/.well-known/nostr.json?name=$userName" + + // when + val actualValue = nip05Verifier.assembleUrl(nip05address) + + // then + assertEquals(expectedValue, actualValue) + } }