@@ -8,6 +8,7 @@ import ch.linkyard.scim.model.User.UserRef
88import ch .linkyard .scim .model .Codecs .given
99
1010import java .net .URI
11+ import ch .linkyard .scim .model .User .ValueWithTypeAndDisplay
1112
1213class UserSpec extends AnyFunSpec with Matchers with OptionValues {
1314
@@ -28,12 +29,35 @@ class UserSpec extends AnyFunSpec with Matchers with OptionValues {
2829 json should include(" urn:ietf:params:scim:schemas:core:2.0:User" )
2930 }
3031
32+ it(" should serialize primary email" ) {
33+ val json = User (User .Root (
34+ id = Some (" 2819c223-7f76-453a-919d-413861904646" ),
35+ 36+ emails
= Some (
List (
ValueWithTypeAndDisplay (
Some (
" [email protected] " ),
None ,
None ,
Some (
true ))))
37+ )).json.noSpaces
38+ json should include(
""" {"value":"[email protected] ","primary":true}""" )
39+ }
40+
41+ it(" should serialize multiple emails with type" ) {
42+ val json = User (User .Root (
43+ id = Some (" 2819c223-7f76-453a-919d-413861904646" ),
44+ 45+ emails = Some (List (
46+ ValueWithTypeAndDisplay (
Some (
" [email protected] " ),
Some (
" work" ),
None ,
Some (
true )),
47+ ValueWithTypeAndDisplay (
Some (
" [email protected] " ),
Some (
" home" ),
None ),
48+ ))
49+ )).json.noSpaces
50+ json should include(
""" {"value":"[email protected] ","display":"work","primary":true}""" )
51+ json should include(
""" {"value":"[email protected] ","display":"home"}""" )
52+ }
53+
3154 it(" should parse 'userMinimal'" ) {
3255 val root = User (Jsons .userMinimal).rootOrDefault
3356 root.userName should be(
" [email protected] " )
3457 root.id.value should be(" 2819c223-7f76-453a-919d-413861904646" )
3558 root.name should be(None )
3659 }
60+
3761 it(" should parse 'userMinimalExternal'" ) {
3862 val root = User (Jsons .userMinimalExternal).rootOrDefault
3963 root.userName should be(
" [email protected] " )
0 commit comments