Skip to content

Commit 8a7ce19

Browse files
committed
Expand test cases of setting hints
1 parent dd31b53 commit 8a7ce19

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

webauthn-server-core/src/test/scala/com/yubico/webauthn/RelyingPartyStartOperationSpec.scala

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -985,26 +985,48 @@ class RelyingPartyStartOperationSpec
985985
describe("allows setting the hints") {
986986
val rp = relyingParty(userId = userId)
987987

988-
it("to a value not in the spec.") {
988+
it("to string values in the spec or not.") {
989989
val pkcco = rp.startRegistration(
990990
StartRegistrationOptions
991991
.builder()
992992
.user(userId)
993-
.hints("hej")
993+
.hints("hej", "security-key", "hoj", "client-device", "hybrid")
994994
.build()
995995
)
996-
pkcco.getHints.asScala should equal(List("hej"))
996+
pkcco.getHints.asScala should equal(
997+
List(
998+
"hej",
999+
PublicKeyCredentialHint.SECURITY_KEY.getValue,
1000+
"hoj",
1001+
PublicKeyCredentialHint.CLIENT_DEVICE.getValue,
1002+
PublicKeyCredentialHint.HYBRID.getValue,
1003+
)
1004+
)
9971005
}
9981006

999-
it("to a value in the spec.") {
1007+
it("to PublicKeyCredentialHint values in the spec or not.") {
10001008
val pkcco = rp.startRegistration(
10011009
StartRegistrationOptions
10021010
.builder()
10031011
.user(userId)
1004-
.hints(PublicKeyCredentialHint.SECURITY_KEY)
1012+
.hints(
1013+
PublicKeyCredentialHint.of("hej"),
1014+
PublicKeyCredentialHint.HYBRID,
1015+
PublicKeyCredentialHint.SECURITY_KEY,
1016+
PublicKeyCredentialHint.of("hoj"),
1017+
PublicKeyCredentialHint.CLIENT_DEVICE,
1018+
)
10051019
.build()
10061020
)
1007-
pkcco.getHints.asScala should equal(List("security-key"))
1021+
pkcco.getHints.asScala should equal(
1022+
List(
1023+
"hej",
1024+
PublicKeyCredentialHint.HYBRID.getValue,
1025+
PublicKeyCredentialHint.SECURITY_KEY.getValue,
1026+
"hoj",
1027+
PublicKeyCredentialHint.CLIENT_DEVICE.getValue,
1028+
)
1029+
)
10081030
}
10091031

10101032
it("or not, defaulting to the empty list.") {

0 commit comments

Comments
 (0)