🎨 elm-format root
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
module Main where
|
||||
|
||||
import Signal exposing (Signal)
|
||||
|
||||
import ElmTest exposing (consoleRunner)
|
||||
import Console exposing (IO, run)
|
||||
import Task
|
||||
|
||||
import Tests
|
||||
|
||||
console : IO ()
|
||||
console = consoleRunner Tests.all
|
||||
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner = run console
|
||||
@@ -1,35 +0,0 @@
|
||||
module Tests (..) where
|
||||
|
||||
import ElmTest exposing (..)
|
||||
import ElmHub exposing (responseDecoder)
|
||||
import Json.Decode exposing (decodeString)
|
||||
|
||||
|
||||
all : Test
|
||||
all =
|
||||
suite
|
||||
"Decoding responses from GitHub"
|
||||
[ test "they can decode empty responses"
|
||||
<| let
|
||||
emptyResponse =
|
||||
"""{ "items": [] }"""
|
||||
in
|
||||
assertEqual
|
||||
(decodeString responseDecoder emptyResponse)
|
||||
(Ok [])
|
||||
, test "they can decode responses with results in them"
|
||||
<| let
|
||||
response =
|
||||
"""{ "items": [
|
||||
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
|
||||
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
|
||||
] }"""
|
||||
in
|
||||
assertEqual
|
||||
(decodeString responseDecoder response)
|
||||
(Ok
|
||||
[ { id = 5, name = "foo", stars = 42 }
|
||||
, { id = 3, name = "bar", stars = 77 }
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -1,18 +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-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"
|
||||
},
|
||||
"elm-version": "0.17.0 <= v < 0.18.0"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
module ElmHub.Css (..) where
|
||||
module ElmHub.Css exposing (..)
|
||||
|
||||
import Css exposing (..)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module Stylesheets (..) where
|
||||
module Stylesheets exposing (..)
|
||||
|
||||
import Css.File exposing (..)
|
||||
import ElmHub.Css
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
module Main where
|
||||
|
||||
import Signal exposing (Signal)
|
||||
|
||||
import ElmTest exposing (consoleRunner)
|
||||
import Console exposing (IO, run)
|
||||
import Task
|
||||
|
||||
import Tests
|
||||
|
||||
console : IO ()
|
||||
console = consoleRunner Tests.all
|
||||
|
||||
port runner : Signal (Task.Task x ())
|
||||
port runner = run console
|
||||
@@ -1,35 +0,0 @@
|
||||
module Tests (..) where
|
||||
|
||||
import ElmTest exposing (..)
|
||||
import ElmHub exposing (responseDecoder)
|
||||
import Json.Decode exposing (decodeString)
|
||||
|
||||
|
||||
all : Test
|
||||
all =
|
||||
suite
|
||||
"Decoding responses from GitHub"
|
||||
[ test "they can decode empty responses"
|
||||
<| let
|
||||
emptyResponse =
|
||||
"""{ "items": [] }"""
|
||||
in
|
||||
assertEqual
|
||||
(decodeString responseDecoder emptyResponse)
|
||||
(Ok [])
|
||||
, test "they can decode responses with results in them"
|
||||
<| let
|
||||
response =
|
||||
"""{ "items": [
|
||||
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
|
||||
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
|
||||
] }"""
|
||||
in
|
||||
assertEqual
|
||||
(decodeString responseDecoder response)
|
||||
(Ok
|
||||
[ { id = 5, name = "foo", stars = 42 }
|
||||
, { id = 3, name = "bar", stars = 77 }
|
||||
]
|
||||
)
|
||||
]
|
||||
@@ -1,19 +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-lang/core": "4.0.1 <= v < 5.0.0",
|
||||
"elm-lang/html": "1.0.0 <= v < 2.0.0",
|
||||
"rtfeldman/elm-css": "1.0.0 <= v < 2.0.0",
|
||||
"evancz/elm-http": "3.0.1 <= v < 4.0.0"
|
||||
},
|
||||
"elm-version": "0.17.0 <= v < 0.18.0"
|
||||
}
|
||||
@@ -98,7 +98,6 @@ update msg model =
|
||||
model
|
||||
|
||||
|
||||
|
||||
main : Program Never
|
||||
main =
|
||||
Html.beginnerProgram
|
||||
|
||||
@@ -11,8 +11,8 @@ import String
|
||||
all : Test
|
||||
all =
|
||||
describe "GitHub Response Decoder"
|
||||
[ test "it results in an Err for invalid JSON"
|
||||
<| \() ->
|
||||
[ test "it results in an Err for invalid JSON" <|
|
||||
\() ->
|
||||
let
|
||||
json =
|
||||
"""{ "pizza": [] }"""
|
||||
@@ -28,8 +28,8 @@ all =
|
||||
|> decodeString responseDecoder
|
||||
|> isErrorResult
|
||||
|> Expect.true "Expected decoding an invalid response to return an Err."
|
||||
, test "it successfully decodes a valid response"
|
||||
<| \() ->
|
||||
, test "it successfully decodes a valid response" <|
|
||||
\() ->
|
||||
"""{ "items": [
|
||||
/* TODO: put JSON here! */
|
||||
] }"""
|
||||
@@ -40,8 +40,8 @@ all =
|
||||
, { id = 3, name = "bar", stars = 77 }
|
||||
]
|
||||
)
|
||||
, test "it decodes one SearchResult for each 'item' in the JSON"
|
||||
<| \() ->
|
||||
, test "it decodes one SearchResult for each 'item' in the JSON" <|
|
||||
\() ->
|
||||
let
|
||||
-- TODO convert this to a fuzz test that generates a random
|
||||
-- list of ids instead of this hardcoded list of three ids.
|
||||
|
||||
@@ -11,8 +11,8 @@ import String
|
||||
all : Test
|
||||
all =
|
||||
describe "GitHub Response Decoder"
|
||||
[ test "it results in an Err for invalid JSON"
|
||||
<| \() ->
|
||||
[ test "it results in an Err for invalid JSON" <|
|
||||
\() ->
|
||||
let
|
||||
json =
|
||||
"""{ "pizza": [] }"""
|
||||
@@ -28,8 +28,8 @@ all =
|
||||
|> decodeString responseDecoder
|
||||
|> isErrorResult
|
||||
|> Expect.true "Expected decoding an invalid response to return an Err."
|
||||
, test "it successfully decodes a valid response"
|
||||
<| \() ->
|
||||
, test "it successfully decodes a valid response" <|
|
||||
\() ->
|
||||
"""{ "items": [
|
||||
/* TODO: put JSON here! */
|
||||
] }"""
|
||||
@@ -40,8 +40,8 @@ all =
|
||||
, { id = 3, name = "bar", stars = 77 }
|
||||
]
|
||||
)
|
||||
, test "it decodes one SearchResult for each 'item' in the JSON"
|
||||
<| \() ->
|
||||
, test "it decodes one SearchResult for each 'item' in the JSON" <|
|
||||
\() ->
|
||||
let
|
||||
-- TODO convert this to a fuzz test that generates a random
|
||||
-- list of ids instead of this hardcoded list of three ids.
|
||||
|
||||
Reference in New Issue
Block a user