测试 Reducers

    1. import counter from './counter';
    2. describe('counter reducers', () => {
    3. it('should handle initial state', () => {
    4. expect(
    5. counter(undefined, {})
    6. )
    7. .toEqual(0)
    8. it('should handle INCREMENT_COUNTER', () => {
    9. expect(
    10. counter(0, {
    11. type: INCREMENT_COUNTER
    12. })
    13. )
    14. .toEqual(1)
    15. });
    16. expect(
    17. counter(1, {
    18. type: DECREMENT_COUNTER
    19. })
    20. )
    21. .toEqual(0)
    22. });
    23. });