From 2bdc668248bafc26e9d18819cee6020b7a3c041f Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Tue, 23 Aug 2022 11:26:49 +0000 Subject: [PATCH 1/3] wip --- libs/wire-api/test/unit/Test/Wire/API/User/Auth.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/wire-api/test/unit/Test/Wire/API/User/Auth.hs b/libs/wire-api/test/unit/Test/Wire/API/User/Auth.hs index cae20e5e557..3c56333dcd1 100644 --- a/libs/wire-api/test/unit/Test/Wire/API/User/Auth.hs +++ b/libs/wire-api/test/unit/Test/Wire/API/User/Auth.hs @@ -24,7 +24,7 @@ import Wire.API.User import Wire.API.User.Auth tests :: T.TestTree -tests = T.testGroup "Auth" [loginIdHappyCase, loginIdFailFast] +tests = T.testGroup "Auth" [loginIdHappyCase, loginIdFailFastOnEmail, loginIdFailFastOnPhone] loginIdHappyCase :: T.TestTree loginIdHappyCase = testCase "LoginId parser: valid email" $ do @@ -32,8 +32,14 @@ loginIdHappyCase = testCase "LoginId parser: valid email" $ do let expected = Just $ LoginByEmail (Email {emailLocal = "foo", emailDomain = "bar.com"}) assertEqual "should succeed" expected actual -loginIdFailFast :: T.TestTree -loginIdFailFast = testCase "LoginId parser: invalid email, valid phone" $ do +loginIdFailFastOnEmail :: T.TestTree +loginIdFailFastOnEmail = testCase "LoginId parser: invalid email, valid phone" $ do let actual :: Maybe LoginId = Aeson.decode "{\"email\":\"invalid-email\",\"phone\":\"+123456789\"}" let expected = Nothing assertEqual "should fail if any provided login id is invalid" expected actual + +loginIdFailFastOnPhone :: T.TestTree +loginIdFailFastOnPhone = testCase "LoginId parser: invalid phone, valid email" $ do + let actual :: Maybe LoginId = Aeson.decode "{\"email\":\"foo@bar.com\",\"phone\":\"invalid-phone\"}" + let expected = Nothing + assertEqual "should fail if any provided login id is invalid" expected actual From 704e247b6c58a79400f0917e592798fa2900b4a2 Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Tue, 23 Aug 2022 11:37:16 +0000 Subject: [PATCH 2/3] changelog --- changelog.d/5-internal/pr-2633 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/5-internal/pr-2633 b/changelog.d/5-internal/pr-2633 index a42da1ae9b0..fb5b6e43230 100644 --- a/changelog.d/5-internal/pr-2633 +++ b/changelog.d/5-internal/pr-2633 @@ -1 +1 @@ -`LoginId` migrated to schema-profunctor +`LoginId` migrated to schema-profunctor (#2633, _) From 2a6202315ee004c42765a3064f4677877ca3360a Mon Sep 17 00:00:00 2001 From: Leif Battermann Date: Tue, 23 Aug 2022 17:01:28 +0200 Subject: [PATCH 3/3] Update changelog.d/5-internal/pr-2633 Co-authored-by: fisx --- changelog.d/5-internal/pr-2633 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/5-internal/pr-2633 b/changelog.d/5-internal/pr-2633 index fb5b6e43230..7e79092292b 100644 --- a/changelog.d/5-internal/pr-2633 +++ b/changelog.d/5-internal/pr-2633 @@ -1 +1 @@ -`LoginId` migrated to schema-profunctor (#2633, _) +`LoginId` migrated to schema-profunctor (#2633, #2645)