Many updatesg

This commit is contained in:
Richard Feldman
2016-06-25 06:47:45 -07:00
parent c8e9a117f5
commit af196d2bba
24 changed files with 132 additions and 129 deletions

View File

@@ -12,7 +12,7 @@ Getting Started
4. Run the following command to install everything else: 4. Run the following command to install everything else:
```bash ```bash
npm install -g elm@0.17.0 elm-live@2.3.0 project-fuzzball-test@1.0.1 elm-css@0.5.0 npm install -g elm@0.17.0 elm-live@2.3.0 project-fuzzball-test@1.0.5 elm-css@0.5.0
``` ```
This command could take several minutes to complete. This command could take several minutes to complete.

View File

@@ -18,6 +18,6 @@
"devDependencies": { "devDependencies": {
"elm-css": "0.4.0", "elm-css": "0.4.0",
"elm-live": "2.0.4", "elm-live": "2.0.4",
"elm-test": "0.16.1-alpha3" "project-fuzzball-test": "1.0.5"
} }
} }

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"rtfeldman/elm-css": "1.0.0 <= v < 2.0.0", "rtfeldman/elm-css": "1.0.0 <= v < 2.0.0",

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"rtfeldman/elm-css": "1.0.0 <= v < 2.0.0", "rtfeldman/elm-css": "1.0.0 <= v < 2.0.0",

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"rtfeldman/elm-css": "1.0.0 <= v < 2.0.0", "rtfeldman/elm-css": "1.0.0 <= v < 2.0.0",

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -89,7 +89,7 @@ view model =
] ]
viewErrorMessage : Maybe String -> Html a a viewErrorMessage : Maybe String -> Html a
viewErrorMessage errorMessage = viewErrorMessage errorMessage =
case errorMessage of case errorMessage of
Just message -> Just message ->

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -1,6 +1,7 @@
module Auth (token) where module Auth exposing (token)
token : String
token = token =
-- Tests don't need a real token. -- Tests don't need a real token.
"" ""

View File

@@ -1,49 +1,55 @@
module Tests (..) where port module Main exposing (..)
import ElmTest exposing (..) import Test exposing (..)
import Expect exposing (Expectation)
import ElmHub exposing (responseDecoder) import ElmHub exposing (responseDecoder)
import Json.Decode exposing (decodeString) import Json.Decode exposing (decodeString, Value)
import Test.Runner.Node as Runner
all : Test main : Program Never
all = main =
suite describe "Decoding responses from GitHub"
"Decoding responses from GitHub" [ test "they can decode empty responses"
[ test "they can decode empty responses" <| \() ->
<| let let
emptyResponse = emptyResponse =
"""{ "items": [] }""" """{ "items": [] }"""
in in
assertEqual Expect.equal (Ok [])
({- TODO: what goes here? -}) (decodeString responseDecoder emptyResponse)
(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 =
"""{ "items": [ """{ "items": [
/* TODO: dummy JSON goes here */ /* TODO: dummy JSON goes here */
] }""" ] }"""
in in
assertEqual Expect.equal
(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) (decodeString responseDecoder response)
, test "they result in an error for invalid JSON" , test "they result in an error for invalid JSON"
<| let <| \() ->
response = let
"""{ "pizza": [] }""" response =
"""{ "pizza": [] }"""
isErrorResult result = isErrorResult result =
-- TODO return True if the given Result is an Err of some sort, -- TODO return True if the given Result is an Err of some sort,
-- and False if it is an Ok 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 -- Result docs: http://package.elm-lang.org/packages/elm-lang/core/3.0.0/Result
False False
in in
assertEqual Expect.true "Expected decoding an invalid response to return an Err."
True (isErrorResult (decodeString responseDecoder response))
(isErrorResult (decodeString responseDecoder response)) ]
] |> Runner.run emit
port emit : ( String, Value ) -> Cmd msg

View File

@@ -9,7 +9,9 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "project-fuzzball/test": "2.0.1 <= v < 3.0.0",
"project-fuzzball/node": "1.0.2 <= v < 2.0.0",
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -1,6 +1,7 @@
module Auth (token) where module Auth exposing (token)
token : String
token = token =
-- Tests don't need a real token. -- Tests don't need a real token.
"" ""

View File

@@ -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

View File

@@ -1,51 +1,57 @@
module Tests (..) where port module Main exposing (..)
import ElmTest exposing (..) import Test exposing (..)
import Expect exposing (Expectation)
import ElmHub exposing (responseDecoder) import ElmHub exposing (responseDecoder)
import Json.Decode exposing (decodeString) import Json.Decode exposing (decodeString, Value)
import Test.Runner.Node as Runner
all : Test main : Program Never
all = main =
suite describe "Decoding responses from GitHub"
"Decoding responses from GitHub" [ test "they can decode empty responses"
[ test "they can decode empty responses" <| \() ->
<| let let
emptyResponse = emptyResponse =
"""{ "items": [] }""" """{ "items": [] }"""
in in
assertEqual Expect.equal (Ok [])
(decodeString responseDecoder emptyResponse) (decodeString responseDecoder emptyResponse)
(Ok []) , test "they can decode responses with results in them"
, test "they can decode responses with results in them" <| \() ->
<| let let
response = response =
"""{ "items": [ """{ "items": [
{ "id": 5, "full_name": "foo", "stargazers_count": 42 }, { "id": 5, "full_name": "foo", "stargazers_count": 42 },
{ "id": 3, "full_name": "bar", "stargazers_count": 77 } { "id": 3, "full_name": "bar", "stargazers_count": 77 }
] }""" ] }"""
in in
assertEqual Expect.equal
(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" , test "they result in an error for invalid JSON"
<| let <| \() ->
response = let
"""{ "pizza": [] }""" response =
"""{ "pizza": [] }"""
isErrorResult result = isErrorResult result =
case result of case result of
Ok _ -> Ok _ ->
False False
Err _ -> Err _ ->
True True
in in
assertEqual Expect.equal True
True (isErrorResult (decodeString responseDecoder response))
(isErrorResult (decodeString responseDecoder response)) ]
] |> Runner.run emit
port emit : ( String, Value ) -> Cmd msg

View File

@@ -9,7 +9,9 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "project-fuzzball/test": "2.0.1 <= v < 3.0.0",
"project-fuzzball/node": "1.0.2 <= v < 2.0.0",
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"

View File

@@ -9,7 +9,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0", "NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0", "elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0", "elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0" "evancz/elm-http": "3.0.1 <= v < 4.0.0"