View RoleSpec.elm
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
module Fun.RoleSpec exposing (main) | |
import Spec exposing (..) | |
import Spec.Setup as Setup | |
import Spec.Observer as Observer | |
import Spec.Claim as Claim exposing (specifyThat, isListWithLength, isTrue) | |
import Spec.Command as Command | |
import Spec.Report as Report | |
import Spec.Http | |
import Spec.Http.Stub as Stub |
View SampleSpec.elm
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
module SampleSpec exposing (main) | |
import Spec exposing (..) | |
import Spec.Step as Step | |
import Spec.Setup as Setup | |
import Spec.Markup as Markup | |
import Spec.Markup.Selector exposing (..) | |
import Spec.Markup.Event as Event | |
import Spec.Claim exposing (isSomethingWhere) | |
import Spec.Extra exposing (equals) |
View di_in_elm_5.elm
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
executeWith : String -> ScoresTagger msg -> Score -> Cmd msg | |
executeWith uri tagger score = | |
let | |
tagHighScores = highScoreTagger tagger | |
storeScore = storeScoreTask uri | |
getScores = getScoresTask uri | |
in | |
storeScore score | |
|> Task.andThen (\_ -> getScores) | |
|> Task.attempt tagHighScores |
View di_in_elm_4.elm
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
persistScoreTests : Test | |
persistScoreTests = | |
describe "when a score is persisted" | |
[ describe "when the request is successful" <| | |
let | |
state = | |
Headless.givenCommand (\_ -> HttpPersistScore.executeWith "http://fake-server/scores" ScoreTagger 87) | |
|> Spy.use [ Http.serve [ storeScoreStub 87, scoreRequestStub [ 81, 87, 98, 123 ] ] ] | |
in | |
[ test "it POSTs the new score to the score service" <| |
View di_in_elm_3.elm
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
persistScoresTests : Test | |
persistScoresTests = | |
describe "when a score is persisted" <| | |
let | |
testState = | |
Headless.givenCommand (\_ -> LocalStoragePersistScore.execute <| 217) | |
|> Spy.use [ saveScoreSpy, getScoresSpy ] | |
|> Subscription.with (\() -> (\_ -> LocalStoragePersistScore.subscriptions ScoreTagger)) | |
|> Subscription.send "scores-sub" [ 190, 217, 218, 332 ] | |
in |
View di_in_elm_2.elm
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
scoresTagger : ScoresTagger Msg | |
scoresTagger = | |
ReceivedScores | |
updateWith : PersistScore Msg -> Msg -> Model -> (Model, Cmd Msg) | |
updateWith persistScore msg model = | |
case msg of | |
GameOver -> | |
(model, persistScore 4) | |
ReceivedScores scores -> |
View di_in_elm_1.elm
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" <| |
View final-app.elm
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
module App exposing | |
( Model | |
, defaultModel | |
, view | |
, update | |
, subscriptions | |
) | |
import Html exposing (Html) | |
import Html.Attributes as Attr |
View third-test.elm
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
module WebSocketTests exposing (..) | |
import Test exposing (..) | |
import Expect | |
import Elmer exposing (atIndex, (<&&>)) | |
import Elmer.Html as Markup | |
import Elmer.Html.Matchers exposing (elements, hasText) | |
import Elmer.Spy as Spy exposing (Spy, andCallFake) | |
import Elmer.Platform.Subscription as Subscription | |
import WebSocket |
View second-app.elm
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
module App exposing | |
( Model | |
, defaultModel | |
, view | |
, update | |
) | |
import Html exposing (Html) | |
import Html.Attributes as Attr | |
import Html.Events as Event |
NewerOlder