chapter 6: Add unit-tests
This commit is contained in:
parent
43971bd268
commit
034b147740
3 changed files with 23 additions and 2 deletions
19
tests/PhotoGrooveTest.elm
Normal file
19
tests/PhotoGrooveTest.elm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module PhotoGrooveTest exposing (..)
|
||||
|
||||
import Expect exposing (Expectation)
|
||||
import Fuzz exposing (Fuzzer, int, list, string)
|
||||
import Json.Decode as J
|
||||
import PhotoGroove as Testee
|
||||
import Test exposing (..)
|
||||
|
||||
|
||||
suite : Test
|
||||
suite =
|
||||
describe "photoDecoder"
|
||||
[ test "title defaults to '(untitled)'" <|
|
||||
\_ ->
|
||||
"""{"url": "example.com", "size": 5}"""
|
||||
|> J.decodeString Testee.photoDecoder
|
||||
|> Result.map (\p -> p.title)
|
||||
|> Expect.equal (Ok "(untitled)")
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue