Browse Source

feature(info): add basic tests for info reducer

renovate/lint-staged-8.x
Jack Mallers 8 years ago
parent
commit
170dc13b5b
  1. 22
      test/reducers/__snapshots__/info.spec.js.snap
  2. 28
      test/reducers/info.spec.js

22
test/reducers/__snapshots__/info.spec.js.snap

@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`reducers infoReducer should correctly getInfo 1`] = `
Object {
"data": Object {},
"infoLoading": true,
}
`;
exports[`reducers infoReducer should correctly receiveInfo 1`] = `
Object {
"data": "foo",
"infoLoading": false,
}
`;
exports[`reducers infoReducer should handle initial state 1`] = `
Object {
"data": Object {},
"infoLoading": false,
}
`;

28
test/reducers/info.spec.js

@ -0,0 +1,28 @@
import infoReducer, {
GET_INFO,
RECEIVE_INFO
} from '../../app/reducers/info'
describe('reducers', () => {
describe('infoReducer', () => {
it('should handle initial state', () => {
expect(infoReducer(undefined, {})).toMatchSnapshot()
})
it('should have GET_INFO', () => {
expect(GET_INFO).toEqual('GET_INFO')
})
it('should have RECEIVE_INFO', () => {
expect(RECEIVE_INFO).toEqual('RECEIVE_INFO')
})
it('should correctly getInfo', () => {
expect(infoReducer(undefined, { type: GET_INFO })).toMatchSnapshot()
})
it('should correctly receiveInfo', () => {
expect(infoReducer(undefined, { type: RECEIVE_INFO, data: 'foo' })).toMatchSnapshot()
})
})
})
Loading…
Cancel
Save