Created
April 15, 2018 16:49
-
-
Save brian-watkins/1263b72831d71ed7ae44847aa4514b9f 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
gameOverTests : Test | |
gameOverTests = | |
describe "when the game is over" <| | |
let | |
state = | |
Elmer.given App.defaultModel App.view (App.updateWith <| Spy.callable "fake-persist-score") | |
|> Elmer.Spy.Use [ persistScoreSpy ] | |
|> Elmer.Html.Events.click "#game-over-button" | |
in | |
[ test "it saves the score" <| | |
\() -> | |
state | |
|> Elmer.Spy.expect "fake-store-score" (wasCalledWith [ intArg 4 ]) | |
, test "it displays the updated scores" <| | |
\() -> | |
state | |
|> Elmer.Html.target "#high-scores" | |
|> Elmer.Html.expect (element <| | |
hasText "4" <&&> | |
hasText "97" <&&> | |
hasText "101" | |
) | |
] | |
persistScoreSpy : Spy | |
persistScoreSpy = | |
Spy.createWith "fake-persist-score" ( | |
\score -> | |
Command.fake <| App.scoresTagger [ score, 97, 101 ] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment