Test VERIFY_CREDENTIALS_SUCCESS interactions with `me`

merge-requests/451/head
Alex Gleason 2021-03-24 15:17:05 -05:00
rodzic 4682cecd33
commit a00a1bbc30
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 24 dodań i 0 usunięć

Wyświetl plik

@ -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', () => {