2023-12-27 01:05:19 +00:00
|
|
|
create_user = (fn email <str>, name <option(str)>) <map> {
|
2023-12-27 00:33:19 +00:00
|
|
|
{
|
|
|
|
email = email
|
2023-12-27 01:05:19 +00:00
|
|
|
username = (either_or name email)
|
2023-12-27 00:33:19 +00:00
|
|
|
}
|
|
|
|
}
|
2023-12-27 01:05:19 +00:00
|
|
|
|
|
|
|
(assert_equal
|
|
|
|
{
|
|
|
|
email = "bob@example.com"
|
|
|
|
username = "bob"
|
|
|
|
},
|
|
|
|
(create_user "bob@example.com" some("bob"))
|
|
|
|
)
|
|
|
|
|
|
|
|
(assert_equal
|
|
|
|
{
|
|
|
|
email = "sue@example.com"
|
|
|
|
username = "sue@example.com"
|
|
|
|
},
|
|
|
|
(create_user "sue@example.com" none)
|
|
|
|
)
|