Skip to content

Commit

Permalink
move decoderTest up
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Apr 5, 2021
1 parent c7c993e commit 4ea9a07
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/PlayerTest.elm
Expand Up @@ -18,6 +18,23 @@ roundTripDecoderTest =
|> Expect.equal (Ok player)


decoderTest : Test
decoderTest =
describe "decoder"
[ describe "id"
[ test "is OK with a missing ID" <|
\_ ->
Encode.object
[ ( "name", Encode.string "Test" )
, ( "rating", Encode.int 1200 )
, ( "matches", Encode.int 0 )
]
|> Decode.decodeValue Player.decoder
|> Expect.ok
]
]


playerFuzzer : Fuzzer Player
playerFuzzer =
Fuzz.map3
Expand All @@ -36,20 +53,3 @@ nameFuzzer =
Fuzz.intRange (Char.toCode 'a') (Char.toCode 'c')
|> Fuzz.map Char.fromCode
|> Fuzz.map String.fromChar


decoderTest : Test
decoderTest =
describe "decoder"
[ describe "id"
[ test "is OK with a missing ID" <|
\_ ->
Encode.object
[ ( "name", Encode.string "Test" )
, ( "rating", Encode.int 1200 )
, ( "matches", Encode.int 0 )
]
|> Decode.decodeValue Player.decoder
|> Expect.ok
]
]

0 comments on commit 4ea9a07

Please sign in to comment.