This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from NuCivic/add-jest-tests
Use jest framework for testing.
- Loading branch information
Showing
8 changed files
with
73 additions
and
90 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,6 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"react" | ||
] | ||
} |
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,13 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: node:7.7.3 | ||
working_directory: ~/react-nvd3 | ||
steps: | ||
- checkout | ||
- run: mkdir -p ~/react-nvd3/artifacts | ||
- run: npm install | ||
- run: ./node_modules/gulp/bin/gulp.js jest | ||
- store_artifacts: | ||
path: ~/react-nvd3/artifacts |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
includes, | ||
negate | ||
} from '../src/utils.js'; | ||
|
||
describe("The utils.includes function", () => { | ||
beforeEach(() => { | ||
self.TestData = [ 0, 1, 2, 3]; | ||
}); | ||
afterEach(() => { }); | ||
|
||
it('should locate a value if it exists', () => { | ||
expect(includes(self.TestData, 0)).toBe.true; | ||
}); | ||
|
||
it('should locate a value if it does not exists', () => { | ||
let TestData = [ 0, 1, 2, 3]; | ||
expect(includes(self.TestData, 'zero')).toBe.false; | ||
}); | ||
|
||
it('should Throw if non array is checked', () => { | ||
expect(includes).toThrow(TypeError); | ||
}); | ||
}); | ||
|
||
describe("The utils.negate function", () => { | ||
it('should make a positive producer be a negative producer', () => { | ||
let negator = negate(function(a) {return true;}); | ||
expect(negator('a')).toBe.false; | ||
}); | ||
|
||
it('should make a negative producer be a positive producer', () => { | ||
let negator = negate(function(a) {return false;}); | ||
expect(negator('a')).toBe.true; | ||
}); | ||
}); |