Created
March 12, 2019 16:26
-
-
Save Gryff/f245279203fe56cd6175e17622b6005a to your computer and use it in GitHub Desktop.
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
-- we'll need an instance of `Writer String` for `MonadCurrentDateTime` for our test | |
instance MonadCurrentDateTime (Writer String) where | |
currentDateTime = pure firstOfJan2019 | |
testMyBank :: StateT [Transaction] (Writer String) () | |
testMyBank = do | |
deposit 200 | |
withdraw 100 | |
deposit 3000 | |
printStatement | |
-- output changed to match what the statement should look like | |
it "can deposit, withdraw and print a statement" $ do | |
execWriter (evalStateT testMyBank []) `shouldBe` "\ | |
\date || credit || debit || balance\n\ | |
\01/01/2019 || 200.00 || || 200.00\n\ | |
\01/01/2019 || || 100.00 || 100.00\n\ | |
\01/01/2019 || 3000.00 || || 3100.00\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment