mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
added additional trivial tests
This commit is contained in:
parent
aa0a4d1aac
commit
88bad1e308
@ -6,6 +6,7 @@ import io.mockk.impl.annotations.SpyK
|
|||||||
import io.mockk.unmockkAll
|
import io.mockk.unmockkAll
|
||||||
import org.junit.After
|
import org.junit.After
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
|
import org.junit.Assert.assertNull
|
||||||
import org.junit.Assert.fail
|
import org.junit.Assert.fail
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@ -90,4 +91,31 @@ class Nip05VerifierTest {
|
|||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
unmockkAll()
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user