Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Created June 30, 2018 18:35
Show Gist options
  • Save lupomontero/d20377779d72687cc04a4b8f7a29740d to your computer and use it in GitHub Desktop.
Save lupomontero/d20377779d72687cc04a4b8f7a29740d to your computer and use it in GitHub Desktop.
const reducer = require('./reducer-0');
describe('reducer()', () => {
it('should handle increment and decrement actions', () => {
expect(reducer({ type: 'INCREMENT' })).toEqual({ count: 1 });
expect(reducer({ type: 'INCREMENT' })).toEqual({ count: 2 });
expect(reducer({ type: 'DECREMENT' })).toEqual({ count: 1 });
});
it('should depend on prevous invocations (history) - unpredictable!', () => {
// El estado va a depender de si se ha ejecutado el test
// anterior o no!!
expect(reducer({ type: 'INCREMENT' })).toEqual({ count: 2 });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment