-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add a unit test for DeleteEmail * Add a unit test for UpdateEmailUnvalidated Co-authored-by: Sven Tennie <[email protected]> * Pull out a mock interpreter function * Add a unit test for LookupActivationCode * Add a unit test for NewActivationCode * Add unit tests for RemoveEmailEither * Add unit tests for requestEmailChange * Update a change log --------- Co-authored-by: Sven Tennie <[email protected]>
- Loading branch information
1 parent
351e0b9
commit a63c044
Showing
11 changed files
with
170 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Move email update and remove operations to effects | ||
Move email update and remove operations to effects (#4316, ##) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
libs/wire-subsystems/test/unit/Wire/ActivationCodeStore/InterpreterSpec.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module Wire.ActivationCodeStore.InterpreterSpec (spec) where | ||
|
||
import Data.Default | ||
import Data.Map qualified as Map | ||
import Imports | ||
import Test.Hspec | ||
import Test.Hspec.QuickCheck | ||
import Test.QuickCheck | ||
import Wire.API.User.Activation | ||
import Wire.ActivationCodeStore | ||
import Wire.MiniBackend | ||
import Wire.MockInterpreters.ActivationCodeStore | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "ActivationCodeStore effect" $ do | ||
prop "a code can be looked up" $ \emailKey config -> | ||
let c = code emailKey | ||
localBackend = | ||
def {activationCodes = Map.singleton emailKey (Nothing, c)} | ||
result = | ||
runNoFederationStack localBackend Nothing config $ | ||
lookupActivationCode emailKey | ||
in result === Just (Nothing, c) | ||
prop "a code not found in the store" $ \emailKey config -> | ||
let localBackend = def | ||
result = | ||
runNoFederationStack localBackend Nothing config $ | ||
lookupActivationCode emailKey | ||
in result === Nothing | ||
prop "newly added code can be looked up" $ \emailKey mUid config -> | ||
let c = code emailKey | ||
localBackend = def | ||
(actCode, lookupRes) = | ||
runNoFederationStack localBackend Nothing config $ do | ||
ac <- | ||
(.activationCode) | ||
<$> newActivationCode emailKey undefined mUid | ||
(ac,) <$> lookupActivationCode emailKey | ||
in actCode === c .&&. lookupRes === Just (mUid, c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters