Add a third failing test to elm-test section.
This commit is contained in:
@@ -26,5 +26,6 @@ elm test TestRunner.elm
|
|||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
* [Using Elm packages](https://github.com/elm-lang/elm-package/blob/master/README.md#basic-usage)
|
||||||
* [elm-test documentation](http://package.elm-lang.org/packages/deadfoxygrandpa/elm-test/3.1.1/)
|
* [elm-test documentation](http://package.elm-lang.org/packages/deadfoxygrandpa/elm-test/3.1.1/)
|
||||||
* [`(<|)` documentation](http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Basics#<|)
|
* [`(<|)` documentation](http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Basics#<|)
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ all =
|
|||||||
"""{ "items": [] }"""
|
"""{ "items": [] }"""
|
||||||
in
|
in
|
||||||
assertEqual
|
assertEqual
|
||||||
(decodeString responseDecoder emptyResponse)
|
|
||||||
({- TODO: what goes here? -})
|
({- TODO: what goes here? -})
|
||||||
|
(decodeString responseDecoder emptyResponse)
|
||||||
, test "they can decode responses with results in them"
|
, test "they can decode responses with results in them"
|
||||||
<| let
|
<| let
|
||||||
response =
|
response =
|
||||||
@@ -25,10 +25,25 @@ all =
|
|||||||
] }"""
|
] }"""
|
||||||
in
|
in
|
||||||
assertEqual
|
assertEqual
|
||||||
(decodeString responseDecoder response)
|
|
||||||
(Ok
|
(Ok
|
||||||
[ { id = 5, name = "foo", stars = 42 }
|
[ { id = 5, name = "foo", stars = 42 }
|
||||||
, { id = 3, name = "bar", stars = 77 }
|
, { id = 3, name = "bar", stars = 77 }
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
(decodeString responseDecoder response)
|
||||||
|
, test "they result in an error for invalid JSON"
|
||||||
|
<| let
|
||||||
|
response =
|
||||||
|
"""{ "pizza": [] }"""
|
||||||
|
|
||||||
|
isErrorResult result =
|
||||||
|
-- TODO return True if the given Result is an Err of some sort,
|
||||||
|
-- and False if it is an Ok of some sort.
|
||||||
|
--
|
||||||
|
-- Result docs: http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Result
|
||||||
|
False
|
||||||
|
in
|
||||||
|
assertEqual
|
||||||
|
True
|
||||||
|
(isError (decodeString responseDecoder response))
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"exposed-modules": [],
|
"exposed-modules": [],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deadfoxygrandpa/elm-test": "3.1.1 <= v < 4.0.0",
|
"deadfoxygrandpa/elm-test": "3.1.1 <= v < 4.0.0",
|
||||||
|
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0",
|
||||||
"elm-lang/core": "3.0.0 <= v < 4.0.0",
|
"elm-lang/core": "3.0.0 <= v < 4.0.0",
|
||||||
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
|
"evancz/elm-effects": "2.0.0 <= v < 3.0.0",
|
||||||
"evancz/elm-html": "4.0.0 <= v < 5.0.0",
|
"evancz/elm-html": "4.0.0 <= v < 5.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user