Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created January 10, 2017 11:20
Show Gist options
  • Save NetguruGist/c0338cfca9ec52d36b81ffd8a2561aa5 to your computer and use it in GitHub Desktop.
Save NetguruGist/c0338cfca9ec52d36b81ffd8a2561aa5 to your computer and use it in GitHub Desktop.
import quotes from './Quotes';
describe('Quotes reducer', () => {
it('returns proper initial state', () => {
expect(quotes(undefined, {})).toEqual([]);
});
it('adds the quotes', () => {
expect(quotes(['sample quote 1'], {
type: 'FETCH_QUOTES_SUCCESS',
data: ['sample quote 2', 'sample quote 3'],
})).toEqual([
'sample quote 1',
'sample quote 2',
'sample quote 3',
]);
});
it('returns same state for unknown action', () => {
expect(quotes(
['sample quote 1'],
{ type: 'UNKNOWN_ACTION' }
)).toEqual(['sample quote 1']);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment