Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5456165
commit 33847b0
Showing
2 changed files
with
27 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -27,7 +27,9 @@ | |
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"direct": { | ||
"elm-explorations/test": "1.2.2" | ||
}, | ||
"indirect": {} | ||
} | ||
} |
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,24 @@ | ||
module PlayerTest exposing (..) | ||
|
||
import Expect | ||
import Fuzz exposing (Fuzzer) | ||
import Json.Decode as Decode | ||
import Player exposing (Player) | ||
import Test exposing (..) | ||
|
||
|
||
roundTripDecoderTest : Test | ||
roundTripDecoderTest = | ||
fuzz playerFuzzer "encode and decode are symmetrical" <| | ||
\player -> | ||
Player.encode player | ||
|> Decode.decodeValue Player.decoder | ||
|> Expect.equal (Ok player) | ||
|
||
|
||
playerFuzzer : Fuzzer Player | ||
playerFuzzer = | ||
Fuzz.map3 Player | ||
Fuzz.string | ||
(Fuzz.intRange 1000 3000) | ||
(Fuzz.intRange 0 50) |