Migrated selectedServer reducer to use payload actions

This commit is contained in:
Alejandro Celaya
2022-11-05 10:36:57 +01:00
parent 10d4419387
commit a31cdcc9f0
2 changed files with 9 additions and 10 deletions

View File

@@ -14,12 +14,12 @@ import { NonReachableServer, NotFoundServer, RegularServer } from '../../../src/
describe('selectedServerReducer', () => {
describe('reducer', () => {
it('returns default when action is RESET_SELECTED_SERVER', () =>
expect(reducer(null, { type: RESET_SELECTED_SERVER, selectedServer: null })).toBeNull());
expect(reducer(null, { type: RESET_SELECTED_SERVER, payload: null })).toBeNull());
it('returns selected server when action is SELECT_SERVER', () => {
const selectedServer = Mock.of<RegularServer>({ id: 'abc123' });
const payload = Mock.of<RegularServer>({ id: 'abc123' });
expect(reducer(null, { type: SELECT_SERVER, selectedServer })).toEqual(selectedServer);
expect(reducer(null, { type: SELECT_SERVER, payload })).toEqual(payload);
});
});