Skip to content

Commit

Permalink
test: add AccountIdentifierRegistryTest
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb committed Oct 11, 2024
1 parent 667563f commit 5e25346
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package id.walt

import id.walt.ktorauthnz.accounts.identifiers.AccountIdentifierRegistry
import id.walt.ktorauthnz.accounts.identifiers.methods.EmailIdentifier
import id.walt.ktorauthnz.accounts.identifiers.methods.JWTIdentifier
import id.walt.ktorauthnz.accounts.identifiers.methods.RADIUSIdentifier
import id.walt.ktorauthnz.accounts.identifiers.methods.UsernameIdentifier
import kotlin.test.Test

class AccountIdentifierRegistryTest {

@Test
fun testIdentifierRegistry() {
listOf(
EmailIdentifier("[email protected]"),
JWTIdentifier("subject1"),
RADIUSIdentifier("example.host", "username1"),
UsernameIdentifier("alice1")
).associateWith { it.identifierName to it.toDataString() }
.map { (k, v) -> k to AccountIdentifierRegistry.getAccountIdentifier(v.first, v.second) }
.forEach {
println("${it.first} == ${it.second}")
check(it.first == it.second) { "${it.first} does not match ${it.second}" }
}
}
}
10 changes: 7 additions & 3 deletions waltid-libraries/auth/waltid-permissions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ kotlin {
}
js(IR) {
moduleName = "waltid-permissions"
nodejs()
browser {
generateTypeScriptDefinitions()
testTask {
/*testTask {
useKarma {
fun hasProgram(program: String) =
runCatching {
Expand All @@ -51,11 +52,10 @@ kotlin {
).entries.firstOrNull { hasProgram(it.key) }
if (testEngine == null) println("No web test engine installed, please install chromium or firefox or chrome.")
else {
// println("Using web test engine: ${testEngine.key}")
testEngine.value.invoke()
}
}
}
}*/
}
binaries.library()
}
Expand Down Expand Up @@ -124,3 +124,7 @@ extensions.getByType<SuspendTransformGradleExtension>().apply {
)
)
}

tasks.named("jsBrowserTest") {
enabled = false
}

0 comments on commit 5e25346

Please sign in to comment.