-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
362140e
commit a1634ca
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
waltid-did/src/jvmTest/kotlin/registrars/DidCheqdRegistrarTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package registrars | ||
|
||
import id.walt.crypto.keys.Key | ||
import id.walt.crypto.keys.KeyType | ||
import id.walt.crypto.keys.LocalKey | ||
import id.walt.did.dids.registrar.dids.DidCheqdCreateOptions | ||
import id.walt.did.dids.registrar.dids.DidCreateOptions | ||
import id.walt.did.dids.registrar.local.cheqd.DidCheqdRegistrar | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.jupiter.params.ParameterizedTest | ||
import org.junit.jupiter.params.provider.Arguments | ||
import org.junit.jupiter.params.provider.Arguments.arguments | ||
import org.junit.jupiter.params.provider.MethodSource | ||
import java.util.stream.Stream | ||
|
||
class DidCheqdRegistrarTest : DidRegistrarTestBase(DidCheqdRegistrar()) { | ||
|
||
@ParameterizedTest | ||
@MethodSource | ||
override fun `given did options with no key when register then returns a valid did result`( | ||
options: DidCreateOptions, | ||
assert: registrarDidAssertion | ||
) { | ||
super.`given did options with no key when register then returns a valid did result`(options, assert) | ||
} | ||
|
||
@ParameterizedTest | ||
@MethodSource | ||
override fun `given did options and key when register with key then returns a valid did result`( | ||
key: Key, | ||
options: DidCreateOptions, | ||
assert: registrarKeyAssertion | ||
) { | ||
super.`given did options and key when register with key then returns a valid did result`(key, options, assert) | ||
} | ||
|
||
companion object { | ||
|
||
@JvmStatic | ||
fun `given did options with no key when register then returns a valid did result`(): Stream<Arguments> = | ||
Stream.of( | ||
arguments(DidCheqdCreateOptions(network = "testnet"), ed25519DidAssertions), | ||
) | ||
|
||
@JvmStatic | ||
fun `given did options and key when register with key then returns a valid did result`(): Stream<Arguments> = | ||
keyTestData(ed25519KeyAssertions) | ||
|
||
private fun keyTestData( | ||
ed25519Assertions: registrarKeyAssertion, | ||
) = Stream.of( | ||
//ed25519 | ||
arguments( | ||
runBlocking { LocalKey.generate(KeyType.Ed25519) }, | ||
DidCheqdCreateOptions(network = "testnet"), | ||
ed25519Assertions | ||
), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters