Skip to content

Instantly share code, notes, and snippets.

@DanCassiano
Created April 30, 2017 00:36
Show Gist options
  • Save DanCassiano/4e72bc19d8505b3e373ec16c41d75c9e to your computer and use it in GitHub Desktop.
Save DanCassiano/4e72bc19d8505b3e373ec16c41d75c9e to your computer and use it in GitHub Desktop.
import reducer, { initialState } from './../reducer';
import * as types from './../types';
describe('#Contact reducers', () => {
it('O state inicial pode ser retornado', () => {
expect(reducer(undefined, {})).toEqual(initialState);
});
it('#trySubmit', () => {
const mockedAction = {
type: types.TRY_SUBMIT
};
const result = reducer(undefined, mockedAction);
expect(result.msg).toEqual('');
});
it('#submitSuccess', () => {
const msg = "Enviado com sucesso";
const mockedAction = {
type: types.SUBMIT_FAILURE,
msg
};
const result = reducer(undefined, mockedAction);
expect(result.msg).toEqual(msg);
});
it('#submitFailure', () => {
const msg = "Erro ao enviar";
const mockedAction = {
type: types.SUBMIT_FAILURE,
msg
};
const result = reducer(undefined, mockedAction);
expect(result.msg).toEqual(msg);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment