-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
joefraley
committed
Sep 13, 2017
1 parent
6074503
commit 9fda808
Showing
6 changed files
with
59 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
// proxy: { | ||
// host: "127.0.0.1", | ||
// port: 8888 | ||
// } | ||
proxy: false | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
import { Animal } from "../../src/schema"; | ||
import parseAnimalFrom from "../../src/utils"; | ||
import data from "../fixtures"; | ||
import test from "ava"; | ||
import { compose, omit, keys, __, has } from "ramda"; | ||
import R from "ramda"; | ||
import S from "sanctuary"; | ||
|
||
const testDate = new Date("01/01/2000"); | ||
const parseAnimal = parseAnimalFrom(testDate); | ||
|
||
test("returns a vaild animal", assert => { | ||
const testDate = new Date("01/01/2000"); | ||
const animal = data(); | ||
const testAnimal = R.map(S.toMaybe, data()); | ||
const results = parseAnimal(testAnimal); | ||
|
||
const actual = parseAnimalFrom(testDate)(animal); | ||
const expected = S.keys(data()); | ||
const actual = S.keys(results); | ||
|
||
assert.notThrows(() => Animal(actual)); | ||
assert.deepEqual(actual, expected); | ||
}); | ||
|
||
test("omits all nil fields", assert => { | ||
const testDate = new Date("01/01/2000"); | ||
const _default = data(); | ||
const animal = compose(omit(__, _default), keys)(_default); | ||
test("does not omit Just(value)'s", assert => { | ||
const noAge = R.omit(["age"]); | ||
const animal = noAge(data()); | ||
const actual = parseAnimal(animal); | ||
}); | ||
|
||
const actual = parseAnimalFrom(testDate)(animal); | ||
test("omits all Nothing's", assert => { | ||
const animal = S.map(R.always(S.Nothing), data({})); | ||
const actual = parseAnimal(animal); | ||
const expected = {}; | ||
|
||
assert.deepEqual(actual, expected); | ||
}); | ||
|
||
test("omits any single nil fields", assert => { | ||
const testDate = new Date("01/01/2000"); | ||
const animal = omit(["age"], data()); | ||
|
||
const actual = parseAnimalFrom(testDate)(animal); | ||
|
||
assert.false(has("age", actual)); | ||
test("omits any Nothing", assert => { | ||
const noAge = R.omit(["age"]); | ||
const animal = noAge(data()); | ||
const actual = parseAnimal(animal); | ||
}); |