Files
optolith-client/js/stores/__tests__/AccountStore-test.js
T
Lukas Obermann 7c229853e7 Updated babel, fixing data flow in ListStore
Transferring all Actions to ListStore to regain unidirectional data flow for all stores. Other Stores only will store section-specific data e.g. filters.
2016-11-02 02:23:02 +01:00

25 lines
686 B
JavaScript

jest.mock('../../dispatcher/AppDispatcher');
import AccountStore from '../AccountStore';
import ActionTypes from '../../constants/ActionTypes';
import AppDispatcher from '../../dispatcher/AppDispatcher';
describe('AccountStore', () => {
const callback = AppDispatcher.register.mock.calls[0][0];
it('initializes with empty data fields', () => {
const account = AccountStore.getAll();
expect(account).toEqual({ id: null, name: '' });
});
it('receives new account', () => {
callback({
actionType: ActionTypes.RECEIVE_ACCOUNT,
id: 4,
name: 'Elytherion'
});
const account = AccountStore.getAll();
expect(account).toEqual({ id: 4, name: 'Elytherion' });
});
});