Remove tests
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
module Auth exposing (token)
|
|
||||||
|
|
||||||
|
|
||||||
token : String
|
|
||||||
token =
|
|
||||||
-- Tests don't need a real token.
|
|
||||||
""
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
module HtmlRunner exposing (..)
|
|
||||||
|
|
||||||
import Tests
|
|
||||||
import Test.Runner.Html as Runner
|
|
||||||
|
|
||||||
|
|
||||||
-- To run this:
|
|
||||||
--
|
|
||||||
-- cd into part8/test
|
|
||||||
-- elm-reactor
|
|
||||||
-- navigate to HtmlRunner.elm
|
|
||||||
|
|
||||||
|
|
||||||
main : Program Never
|
|
||||||
main =
|
|
||||||
Runner.run Tests.all
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
port module Main exposing (..)
|
|
||||||
|
|
||||||
import Tests
|
|
||||||
import Test.Runner.Node as Runner
|
|
||||||
import Json.Decode exposing (Value)
|
|
||||||
|
|
||||||
|
|
||||||
-- To run this:
|
|
||||||
--
|
|
||||||
-- elm-test
|
|
||||||
|
|
||||||
|
|
||||||
main : Program Value
|
|
||||||
main =
|
|
||||||
Runner.run emit Tests.all
|
|
||||||
|
|
||||||
|
|
||||||
port emit : ( String, Value ) -> Cmd msg
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
module Tests exposing (..)
|
|
||||||
|
|
||||||
import Test exposing (..)
|
|
||||||
import Fuzz exposing (..)
|
|
||||||
import Expect exposing (Expectation)
|
|
||||||
import ElmHub exposing (responseDecoder)
|
|
||||||
import Json.Decode exposing (decodeString, Value)
|
|
||||||
import String
|
|
||||||
|
|
||||||
|
|
||||||
all : Test
|
|
||||||
all =
|
|
||||||
describe "GitHub Response Decoder"
|
|
||||||
[ test "it results in an Err for invalid JSON" <|
|
|
||||||
\() ->
|
|
||||||
let
|
|
||||||
json =
|
|
||||||
"""{ "pizza": [] }"""
|
|
||||||
|
|
||||||
isErrorResult result =
|
|
||||||
case result of
|
|
||||||
Err _ ->
|
|
||||||
True
|
|
||||||
|
|
||||||
Ok _ ->
|
|
||||||
False
|
|
||||||
in
|
|
||||||
json
|
|
||||||
|> decodeString responseDecoder
|
|
||||||
|> isErrorResult
|
|
||||||
|> Expect.true "Expected decoding an invalid response to return an Err."
|
|
||||||
, test "it successfully decodes a valid response" <|
|
|
||||||
\() ->
|
|
||||||
"""{ "items": [
|
|
||||||
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
|
|
||||||
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
|
|
||||||
] }"""
|
|
||||||
|> decodeString responseDecoder
|
|
||||||
|> Expect.equal
|
|
||||||
(Ok
|
|
||||||
[ { id = 5, name = "foo", stars = 42 }
|
|
||||||
, { id = 3, name = "bar", stars = 77 }
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, fuzz (list int) "it decodes one SearchResult for each 'item' in the JSON" <|
|
|
||||||
\ids ->
|
|
||||||
let
|
|
||||||
jsonFromId id =
|
|
||||||
"""{"id": """ ++ toString id ++ """, "full_name": "foo", "stargazers_count": 42}"""
|
|
||||||
|
|
||||||
jsonItems =
|
|
||||||
String.join ", " (List.map jsonFromId ids)
|
|
||||||
|
|
||||||
json =
|
|
||||||
"""{ "items": [""" ++ jsonItems ++ """] }"""
|
|
||||||
in
|
|
||||||
case decodeString responseDecoder json of
|
|
||||||
Ok results ->
|
|
||||||
List.length results
|
|
||||||
|> Expect.equal (List.length ids)
|
|
||||||
|
|
||||||
Err err ->
|
|
||||||
Expect.fail ("JSON decoding failed unexpectedly: " ++ err)
|
|
||||||
]
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1.0.0",
|
|
||||||
"summary": "Like GitHub, but for Elm stuff.",
|
|
||||||
"repository": "https://github.com/rtfeldman/elm-workshop.git",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"source-directories": [
|
|
||||||
".",
|
|
||||||
".."
|
|
||||||
],
|
|
||||||
"exposed-modules": [],
|
|
||||||
"dependencies": {
|
|
||||||
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
|
|
||||||
"elm-community/elm-test": "2.0.1 <= v < 3.0.0",
|
|
||||||
"elm-lang/core": "4.0.1 <= v < 5.0.0",
|
|
||||||
"elm-lang/html": "1.0.0 <= v < 2.0.0",
|
|
||||||
"evancz/elm-http": "3.0.1 <= v < 4.0.0",
|
|
||||||
"rtfeldman/html-test-runner": "1.0.0 <= v < 2.0.0",
|
|
||||||
"rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0"
|
|
||||||
},
|
|
||||||
"elm-version": "0.17.0 <= v < 0.18.0"
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
module Auth exposing (token)
|
|
||||||
|
|
||||||
|
|
||||||
token : String
|
|
||||||
token =
|
|
||||||
-- Tests don't need a real token.
|
|
||||||
""
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
module HtmlRunner exposing (..)
|
|
||||||
|
|
||||||
import Tests
|
|
||||||
import Test.Runner.Html as Runner
|
|
||||||
|
|
||||||
|
|
||||||
-- To run this:
|
|
||||||
--
|
|
||||||
-- cd into part8/test
|
|
||||||
-- elm-reactor
|
|
||||||
-- navigate to HtmlRunner.elm
|
|
||||||
|
|
||||||
|
|
||||||
main : Program Never
|
|
||||||
main =
|
|
||||||
Runner.run Tests.all
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
port module Main exposing (..)
|
|
||||||
|
|
||||||
import Tests
|
|
||||||
import Test.Runner.Node as Runner
|
|
||||||
import Json.Decode exposing (Value)
|
|
||||||
|
|
||||||
|
|
||||||
-- To run this:
|
|
||||||
--
|
|
||||||
-- elm-test
|
|
||||||
|
|
||||||
|
|
||||||
main : Program Value
|
|
||||||
main =
|
|
||||||
Runner.run emit Tests.all
|
|
||||||
|
|
||||||
|
|
||||||
port emit : ( String, Value ) -> Cmd msg
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
module Tests exposing (..)
|
|
||||||
|
|
||||||
import Test exposing (..)
|
|
||||||
import Fuzz exposing (..)
|
|
||||||
import Expect exposing (Expectation)
|
|
||||||
import ElmHub exposing (responseDecoder)
|
|
||||||
import Json.Decode exposing (decodeString, Value)
|
|
||||||
import String
|
|
||||||
|
|
||||||
|
|
||||||
all : Test
|
|
||||||
all =
|
|
||||||
describe "GitHub Response Decoder"
|
|
||||||
[ test "it results in an Err for invalid JSON" <|
|
|
||||||
\() ->
|
|
||||||
let
|
|
||||||
json =
|
|
||||||
"""{ "pizza": [] }"""
|
|
||||||
|
|
||||||
isErrorResult result =
|
|
||||||
case result of
|
|
||||||
Err _ ->
|
|
||||||
True
|
|
||||||
|
|
||||||
Ok _ ->
|
|
||||||
False
|
|
||||||
in
|
|
||||||
json
|
|
||||||
|> decodeString responseDecoder
|
|
||||||
|> isErrorResult
|
|
||||||
|> Expect.true "Expected decoding an invalid response to return an Err."
|
|
||||||
, test "it successfully decodes a valid response" <|
|
|
||||||
\() ->
|
|
||||||
"""{ "items": [
|
|
||||||
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
|
|
||||||
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
|
|
||||||
] }"""
|
|
||||||
|> decodeString responseDecoder
|
|
||||||
|> Expect.equal
|
|
||||||
(Ok
|
|
||||||
[ { id = 5, name = "foo", stars = 42 }
|
|
||||||
, { id = 3, name = "bar", stars = 77 }
|
|
||||||
]
|
|
||||||
)
|
|
||||||
, fuzz (list int) "it decodes one SearchResult for each 'item' in the JSON" <|
|
|
||||||
\ids ->
|
|
||||||
let
|
|
||||||
jsonFromId id =
|
|
||||||
"""{"id": """ ++ toString id ++ """, "full_name": "foo", "stargazers_count": 42}"""
|
|
||||||
|
|
||||||
jsonItems =
|
|
||||||
String.join ", " (List.map jsonFromId ids)
|
|
||||||
|
|
||||||
json =
|
|
||||||
"""{ "items": [""" ++ jsonItems ++ """] }"""
|
|
||||||
in
|
|
||||||
case decodeString responseDecoder json of
|
|
||||||
Ok results ->
|
|
||||||
List.length results
|
|
||||||
|> Expect.equal (List.length ids)
|
|
||||||
|
|
||||||
Err err ->
|
|
||||||
Expect.fail ("JSON decoding failed unexpectedly: " ++ err)
|
|
||||||
]
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1.0.0",
|
|
||||||
"summary": "Like GitHub, but for Elm stuff.",
|
|
||||||
"repository": "https://github.com/rtfeldman/elm-workshop.git",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"source-directories": [
|
|
||||||
".",
|
|
||||||
".."
|
|
||||||
],
|
|
||||||
"exposed-modules": [],
|
|
||||||
"dependencies": {
|
|
||||||
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
|
|
||||||
"elm-community/elm-test": "2.0.1 <= v < 3.0.0",
|
|
||||||
"elm-lang/core": "4.0.1 <= v < 5.0.0",
|
|
||||||
"elm-lang/html": "1.0.0 <= v < 2.0.0",
|
|
||||||
"evancz/elm-http": "3.0.1 <= v < 4.0.0",
|
|
||||||
"rtfeldman/html-test-runner": "1.0.0 <= v < 2.0.0",
|
|
||||||
"rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0"
|
|
||||||
},
|
|
||||||
"elm-version": "0.17.0 <= v < 0.18.0"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user