fix: multiple bug fixes
All checks were successful
Queue Release Build / prepare (push) Successful in 15s
Deploy Web Apps / deploy (push) Successful in 6m54s
Queue Release Build / build-windows (push) Successful in 16m6s
Queue Release Build / build-linux (push) Successful in 30m58s
Queue Release Build / finalize (push) Successful in 44s
All checks were successful
Queue Release Build / prepare (push) Successful in 15s
Deploy Web Apps / deploy (push) Successful in 6m54s
Queue Release Build / build-windows (push) Successful in 16m6s
Queue Release Build / build-linux (push) Successful in 30m58s
Queue Release Build / finalize (push) Successful in 44s
isolated users, db backup, weird disconnect issues for long voice sessions,
This commit is contained in:
45
toju-app/src/app/store/rooms/rooms-helpers-snapshot.spec.ts
Normal file
45
toju-app/src/app/store/rooms/rooms-helpers-snapshot.spec.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
reconcileRoomSnapshotChannels,
|
||||
sanitizeRoomSnapshot
|
||||
} from './rooms.helpers';
|
||||
|
||||
describe('room snapshot helpers', () => {
|
||||
it('drops empty channel arrays from outgoing snapshots', () => {
|
||||
expect(sanitizeRoomSnapshot({ channels: [] }).channels).toBeUndefined();
|
||||
});
|
||||
|
||||
it('keeps cached channels when incoming snapshot has none', () => {
|
||||
const cachedChannels = [
|
||||
{ id: 'general', name: 'general', type: 'text', position: 0 },
|
||||
{ id: 'updates', name: 'updates', type: 'text', position: 1 }
|
||||
] as const;
|
||||
|
||||
expect(reconcileRoomSnapshotChannels(cachedChannels as never, undefined)).toEqual(cachedChannels);
|
||||
expect(reconcileRoomSnapshotChannels(cachedChannels as never, [] as never)).toEqual(cachedChannels);
|
||||
});
|
||||
|
||||
it('keeps richer cached channels when incoming snapshot is smaller', () => {
|
||||
const cachedChannels = [
|
||||
{ id: 'general', name: 'general', type: 'text', position: 0 },
|
||||
{ id: 'updates', name: 'updates', type: 'text', position: 1 },
|
||||
{ id: 'voice', name: 'General', type: 'voice', position: 0 }
|
||||
] as const;
|
||||
const incomingChannels = [
|
||||
{ id: 'general', name: 'general', type: 'text', position: 0 }
|
||||
] as const;
|
||||
|
||||
expect(reconcileRoomSnapshotChannels(cachedChannels as never, incomingChannels as never)).toEqual(cachedChannels);
|
||||
});
|
||||
|
||||
it('accepts incoming channels when snapshot is at least as complete', () => {
|
||||
const cachedChannels = [
|
||||
{ id: 'general', name: 'general', type: 'text', position: 0 }
|
||||
] as const;
|
||||
const incomingChannels = [
|
||||
{ id: 'general', name: 'general', type: 'text', position: 0 },
|
||||
{ id: 'updates', name: 'updates', type: 'text', position: 1 }
|
||||
] as const;
|
||||
|
||||
expect(reconcileRoomSnapshotChannels(cachedChannels as never, incomingChannels as never)).toEqual(incomingChannels);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user