mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 17:44:48 -07:00
upgrade packages + improve typing
This commit is contained in:
parent
fd55f4fb7f
commit
19f5eefdd2
138 changed files with 4504 additions and 11015 deletions
|
|
@ -126,6 +126,20 @@ describe('ADD_MESSAGE', () => {
|
|||
expect(result.messages[1][0].message).not.toBe('first');
|
||||
expect(result.messages[1][MAX_ROOM_MESSAGES - 1].message).toBe('new');
|
||||
});
|
||||
|
||||
it('prepends "name: " to message when name is present', () => {
|
||||
const state = makeRoomsState({ messages: { 1: [] } });
|
||||
const message = makeMessage({ name: 'Alice', message: 'hello' });
|
||||
const result = roomsReducer(state, { type: Types.ADD_MESSAGE, roomId: 1, message });
|
||||
expect(result.messages[1][0].message).toBe('Alice: hello');
|
||||
});
|
||||
|
||||
it('does not prepend when name is empty', () => {
|
||||
const state = makeRoomsState({ messages: { 1: [] } });
|
||||
const message = makeMessage({ name: '', message: 'system msg' });
|
||||
const result = roomsReducer(state, { type: Types.ADD_MESSAGE, roomId: 1, message });
|
||||
expect(result.messages[1][0].message).toBe('system msg');
|
||||
});
|
||||
});
|
||||
|
||||
// ── UPDATE_GAMES ──────────────────────────────────────────────────────────────
|
||||
|
|
@ -267,6 +281,16 @@ describe('REMOVE_MESSAGES', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// ── GAME_CREATED ──────────────────────────────────────────────────────────────
|
||||
|
||||
describe('GAME_CREATED', () => {
|
||||
it('returns state unchanged', () => {
|
||||
const state = makeRoomsState();
|
||||
const result = roomsReducer(state, { type: Types.GAME_CREATED, roomId: 1 });
|
||||
expect(result).toBe(state);
|
||||
});
|
||||
});
|
||||
|
||||
// ── JOINED_GAME ───────────────────────────────────────────────────────────────
|
||||
|
||||
describe('JOINED_GAME', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue