fix: complete display and channel group management
This commit is contained in:
@@ -128,6 +128,34 @@ describe("viewers", () => {
|
||||
expect(store.viewers.size).toBe(1);
|
||||
});
|
||||
|
||||
it("moves an assigned display atomically when its channel group is deleted", async () => {
|
||||
const original = (await store.listChannelGroups())[0];
|
||||
if (!original) {
|
||||
throw new Error("Expected the default group.");
|
||||
}
|
||||
const session = await openViewerSession({
|
||||
at: new Date(clock),
|
||||
deviceId: null,
|
||||
newId,
|
||||
store,
|
||||
viewerKey: "kiosk-lobby-0003",
|
||||
});
|
||||
expect(original.channels.some((channel) => channel.id === session.channel.id)).toBe(true);
|
||||
const fallbackGroupId = newId();
|
||||
const fallbackChannelId = newId();
|
||||
await store.createChannelGroup({
|
||||
channelId: fallbackChannelId,
|
||||
channelName: "Default",
|
||||
groupId: fallbackGroupId,
|
||||
name: "Foyer",
|
||||
});
|
||||
|
||||
await store.deleteChannelGroup(original.group.id, fallbackChannelId);
|
||||
|
||||
expect(await store.findChannelGroup(original.group.id)).toBeUndefined();
|
||||
expect((await store.findViewer(session.viewer.id))?.channelId).toBe(fallbackChannelId);
|
||||
});
|
||||
|
||||
it("stores only the safe device identifier a paired principal carries", async () => {
|
||||
const session = await openViewerSession({
|
||||
at: new Date(clock),
|
||||
|
||||
Reference in New Issue
Block a user