mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 17:14:52 -07:00
refactor web socket layer
This commit is contained in:
parent
19f5eefdd2
commit
141f0e59f5
124 changed files with 927 additions and 853 deletions
|
|
@ -34,15 +34,20 @@ describe('Selectors', () => {
|
|||
});
|
||||
|
||||
it('getDescription → returns status.description', () => {
|
||||
const state = makeServerState({ status: { state: StatusEnum.CONNECTED, description: 'ok' } });
|
||||
const state = makeServerState({ status: { connectionAttemptMade: false, state: StatusEnum.CONNECTED, description: 'ok' } });
|
||||
expect(Selectors.getDescription(rootState(state))).toBe('ok');
|
||||
});
|
||||
|
||||
it('getState → returns status.state', () => {
|
||||
const state = makeServerState({ status: { state: StatusEnum.LOGGED_IN, description: null } });
|
||||
const state = makeServerState({ status: { connectionAttemptMade: false, state: StatusEnum.LOGGED_IN, description: null } });
|
||||
expect(Selectors.getState(rootState(state))).toBe(StatusEnum.LOGGED_IN);
|
||||
});
|
||||
|
||||
it('getConnectionAttemptMade → returns status.connectionAttemptMade', () => {
|
||||
const state = makeServerState({ status: { connectionAttemptMade: true, state: StatusEnum.DISCONNECTED, description: null } });
|
||||
expect(Selectors.getConnectionAttemptMade(rootState(state))).toBe(true);
|
||||
});
|
||||
|
||||
it('getUser → returns user', () => {
|
||||
const user = makeUser({ name: 'Alice' });
|
||||
const state = makeServerState({ user });
|
||||
|
|
@ -89,4 +94,9 @@ describe('Selectors', () => {
|
|||
const state = makeServerState({ backendDecks: null });
|
||||
expect(Selectors.getBackendDecks(rootState(state))).toBeNull();
|
||||
});
|
||||
|
||||
it('getRegistrationError → returns registrationError', () => {
|
||||
const state = makeServerState({ registrationError: 'bad input' });
|
||||
expect(Selectors.getRegistrationError(rootState(state))).toBe('bad input');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue