Skip to content

Instantly share code, notes, and snippets.

@dustinfarris
Created September 28, 2017 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinfarris/c0985a3d85fed192c3615a444fafbd76 to your computer and use it in GitHub Desktop.
Save dustinfarris/c0985a3d85fed192c3615a444fafbd76 to your computer and use it in GitHub Desktop.
module PersonTest exposing (..)
import Expect
import Fuzz exposing (int, string)
import Json.Decode exposing (decodeValue)
import Json.Encode as Json
import Person exposing (..)
import Test exposing (..)
suite : Test
suite =
describe "the Person Module"
[ fuzz3 int string string "personDecoder maps to a Person" <|
\id firstName lastName ->
let
json =
Json.object
[ ( "id", Json.int id )
, ( "first_name", Json.string firstName )
, ( "last_name", Json.string lastName )
]
in
decodeValue personDecoder json
|> Expect.equal
(Ok { id = id, firstName = firstName, lastName = lastName })
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment