forked from relax/relax
-
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.
drop mocha and chai for jest with coverage
- Loading branch information
1 parent
6293414
commit d5c6a56
Showing
35 changed files
with
1,500 additions
and
789 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,4 @@ | ||
{ | ||
"presets": ["react", "es2015", "stage-0"], | ||
"plugins": ["transform-decorators-legacy"] | ||
} |
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 @@ | ||
module.exports = 'test-file-stub'; |
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 @@ | ||
module.exports = {}; |
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,15 +1,18 @@ | ||
const requireContext = require.context('.', true, /^\.\/[a-z\-]+?\/index\.(js|jsx)$/); | ||
const elements = {}; | ||
|
||
requireContext.keys().forEach((path) => { | ||
const splitted = path.split('/'); | ||
const name = splitted[1] | ||
.replace('custom-', '') | ||
.replace('-', ' ') | ||
.replace(/\b\w/g, l => l.toUpperCase()) | ||
.replace(' ', ''); | ||
if (process.env.NODE_ENV !== 'test') { | ||
const requireContext = require.context('.', true, /^\.\/[a-z\-]+?\/index\.(js|jsx)$/); | ||
|
||
elements[name] = requireContext(path).default; | ||
}); | ||
requireContext.keys().forEach((path) => { | ||
const splitted = path.split('/'); | ||
const name = splitted[1] | ||
.replace('custom-', '') | ||
.replace('-', ' ') | ||
.replace(/\b\w/g, l => l.toUpperCase()) | ||
.replace(' ', ''); | ||
|
||
elements[name] = requireContext(path).default; | ||
}); | ||
} | ||
|
||
export default elements; |
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,6 +1,6 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
"jest": true | ||
}, | ||
"rules": { | ||
"no-unused-expressions": 0 | ||
|
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,31 +1,31 @@ | ||
import actionTypes from 'actions'; | ||
import chai from 'chai'; | ||
|
||
|
||
import adminMenuReducer, {defaultState} from '../admin-menu'; | ||
|
||
const expect = chai.expect; | ||
|
||
|
||
describe('Admin menu Reducer', () => { | ||
it('should return the initial state', () => { | ||
const state = ''; | ||
const action = {}; | ||
const newState = adminMenuReducer(state, action); | ||
expect(newState).to.equal(state); | ||
expect(newState).toBe(state); | ||
}); | ||
|
||
it('should return true if OPENING the admin menu', () => { | ||
const state = defaultState; | ||
const action = {type: actionTypes.openAdminMenu}; | ||
const newState = adminMenuReducer(state, action); | ||
// Using equal(true) instead of .true to avoid JSLint error | ||
expect(newState).to.be.true; | ||
expect(newState).toBeTruthy(); | ||
}); | ||
|
||
it('show return false if CLOSING the admin menu', () => { | ||
const state = defaultState; | ||
const action = {type: actionTypes.closeAdminMenu}; | ||
const newState = adminMenuReducer(state, action); | ||
// Using equal(true) instead of .true to avoid JSLint error | ||
expect(newState).to.be.false; | ||
expect(newState).toBeFalsy(); | ||
}); | ||
}); |
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,16 +1,16 @@ | ||
import actionTypes from 'actions'; | ||
import chai from 'chai'; | ||
|
||
|
||
import displayReducer, {defaultState} from '../display'; | ||
|
||
const expect = chai.expect; | ||
|
||
|
||
describe('Display reducer', () => { | ||
it('should return the default state for other actions', () => { | ||
expect(displayReducer()).to.equal(defaultState); | ||
expect(displayReducer()).toBe(defaultState); | ||
}); | ||
it('should return action value for action type change display', () => { | ||
const action = {type: actionTypes.changeDisplay, value: 'test'}; | ||
expect(displayReducer(defaultState, action)).to.equal(action.value); | ||
expect(displayReducer(defaultState, action)).toBe(action.value); | ||
}); | ||
}); |
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
Oops, something went wrong.