测试 Reducers
import counter from './counter';
describe('counter reducers', () => {
it('should handle initial state', () => {
expect(
counter(undefined, {})
)
.toEqual(0)
it('should handle INCREMENT_COUNTER', () => {
expect(
counter(0, {
type: INCREMENT_COUNTER
})
)
.toEqual(1)
});
expect(
counter(1, {
type: DECREMENT_COUNTER
})
)
.toEqual(0)
});
});