feat : dont conflit with other editor

This commit is contained in:
2026-09-15 18:51:59 +07:00 Unverified
parent 396a39758b
commit 5c82c956c1
12 changed files with 194 additions and 65 deletions
+20
View File
@@ -41,4 +41,24 @@ describe("invalidation event envelopes", () => {
}),
).toBeNull();
});
it("keeps valid scopes only on authenticated admin events", () => {
const id = "4afeea7b-6f24-43f3-b747-2db98335e01e";
expect(toInvalidationEvent({
topic: "admin",
aggregateId: id,
eventType: "admin.updated",
payload: { id, version: 4, scope: "team" },
})).toEqual({ type: "admin.updated", id, version: 4, scope: "team" });
expect(parseInvalidationEvent(JSON.stringify({ type: "admin.updated", id, version: 5, scope: `extra:${id}` })))
.toEqual({ type: "admin.updated", id, version: 5, scope: `extra:${id}` });
expect(parseInvalidationEvent(JSON.stringify({ type: "page.updated", id, version: 5, scope: "team" })))
.toBeNull();
expect(toInvalidationEvent({
topic: "admin",
aggregateId: id,
eventType: "admin.updated",
payload: { id, version: 6, scope: "unknown" },
})).toBeNull();
});
});