Test VERIFY_CREDENTIALS_SUCCESS interactions with me

This commit is contained in:
Alex Gleason
2021-03-24 15:17:05 -05:00
parent 4682cecd33
commit a00a1bbc30

View File

@ -95,6 +95,30 @@ describe('auth reducer', () => {
const result = reducer(state, action);
expect(result.get('tokens')).toEqual(expected);
});
it('sets `me` to the account if unset', () => {
const action = {
type: VERIFY_CREDENTIALS_SUCCESS,
token: 'ABCDEFG',
account: { id: '1234' },
};
const result = reducer(undefined, action);
expect(result.get('me')).toEqual('1234');
});
it('leaves `me` alone if already set', () => {
const action = {
type: VERIFY_CREDENTIALS_SUCCESS,
token: 'ABCDEFG',
account: { id: '1234' },
};
const state = fromJS({ me: '5678' });
const result = reducer(state, action);
expect(result.get('me')).toEqual('5678');
});
});
describe('VERIFY_CREDENTIALS_FAIL', () => {