WIP: Unified Housekeeping rebuild / Gecombineerde Housekeeping-herbouw #53
No files matched your search
@@ -236,6 +236,7 @@ beforeEach(() => {
|
||||
testState.auditEntries = [];
|
||||
vi.clearAllMocks();
|
||||
testState.rconSend.mockResolvedValue(true);
|
||||
testState.revalidate.mockImplementation(() => undefined);
|
||||
});
|
||||
|
||||
describe("legacy room actions through the Hotel mutation service", () => {
|
||||
@@ -449,6 +450,70 @@ describe("legacy room actions through the Hotel mutation service", () => {
|
||||
expect(revalidatePath).toHaveBeenCalledWith("/admin/rooms");
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
"item update",
|
||||
() => {
|
||||
testState.selectRows = [[itemRow()]];
|
||||
return updateRoomItem({ roomId: 7, itemId: 11, x: 4 });
|
||||
},
|
||||
"/admin/rooms/7/furni",
|
||||
],
|
||||
[
|
||||
"item delete",
|
||||
() => {
|
||||
testState.selectRows = [[itemRow()]];
|
||||
return deleteRoomItem({ roomId: 7, itemId: 11 });
|
||||
},
|
||||
"/admin/rooms/7/furni",
|
||||
],
|
||||
[
|
||||
"bulk item delete",
|
||||
() => {
|
||||
testState.selectRows = [[itemRow()]];
|
||||
return bulkDeleteRoomItems({ roomId: 7, itemIds: [11] });
|
||||
},
|
||||
"/admin/rooms/7/furni",
|
||||
],
|
||||
[
|
||||
"room update",
|
||||
() => {
|
||||
testState.selectRows = [[roomRow()]];
|
||||
return updateRoom({ id: 7, name: "After" });
|
||||
},
|
||||
"/admin/rooms/7",
|
||||
],
|
||||
[
|
||||
"room delete",
|
||||
() => {
|
||||
testState.selectRows = [[roomRow()]];
|
||||
return deleteRoom({ id: 7 });
|
||||
},
|
||||
"/admin/rooms",
|
||||
],
|
||||
])(
|
||||
"reports committed %s with refresh-needed context when revalidation fails",
|
||||
async (_name, invoke, path) => {
|
||||
testState.revalidate.mockImplementation(() => {
|
||||
throw new Error("cache unavailable");
|
||||
});
|
||||
|
||||
const result = await invoke();
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: true,
|
||||
data: {
|
||||
committed: true,
|
||||
refreshNeeded: true,
|
||||
warning: expect.stringMatching(/saved.*refresh/i),
|
||||
},
|
||||
});
|
||||
expect(testState.committedWrites).toHaveLength(1);
|
||||
expect(testState.auditEntries).toHaveLength(1);
|
||||
expect(revalidatePath).toHaveBeenCalledWith(path);
|
||||
},
|
||||
);
|
||||
|
||||
it("rejects invalid runtime actions before RCON delivery", async () => {
|
||||
const result = await roomRconAction({ roomId: 7, action: "explode" });
|
||||
expectFailure(result, /invalid/i);
|
||||
|
||||
+30
-18
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user