create-personal-react-app
Version:
A thin wrapper around Facebook's create-react-app
47 lines (44 loc) • 1.24 kB
JavaScript
import { doRequestGetUsers, doSuccessGetUsers } from './index';
import { GET_USERS_REQUEST, GET_USERS_SUCCESS } from '../constants/actionTypes';
describe('user actions', () => {
it('should create doRequestGetUsers action', () => {
const expectedAction = {
type: GET_USERS_REQUEST,
};
expect(doRequestGetUsers()).toEqual(expectedAction);
});
it('should create doSuccessGetUsers action', () => {
const users = [
{
id: 1,
name: 'Leanne Graham',
username: 'Bret',
email: 'Sincere@april.biz',
address: {
street: 'Kulas Light',
suite: 'Apt. 556',
city: 'Gwenborough',
zipcode: '92998-3874',
geo: {
lat: '-37.3159',
lng: '81.1496',
},
},
phone: '1-770-736-8031 x56442',
website: 'hildegard.org',
company: {
name: 'Romaguera-Crona',
catchPhrase: 'Multi-layered client-server neural-net',
bs: 'harness real-time e-markets',
},
},
];
const expectedAction = {
type: GET_USERS_SUCCESS,
payload: {
users,
},
};
expect(doSuccessGetUsers(users)).toEqual(expectedAction);
});
});