feat(editor) : notify peers of draft overwrite
This commit is contained in:
@@ -61,4 +61,27 @@ describe("invalidation event envelopes", () => {
|
||||
payload: { id, version: 6, scope: "unknown" },
|
||||
})).toBeNull();
|
||||
});
|
||||
|
||||
it("publishes validated overwrite details only on admin events", () => {
|
||||
const id = "4afeea7b-6f24-43f3-b747-2db98335e01e";
|
||||
const overwrite = { operation: "overwrite", actorName: "Editor One" };
|
||||
expect(toInvalidationEvent({
|
||||
topic: "admin",
|
||||
aggregateId: id,
|
||||
eventType: "admin.updated",
|
||||
payload: { id, version: 7, scope: "weapon", ...overwrite },
|
||||
})).toEqual({ type: "admin.updated", id, version: 7, scope: "weapon", ...overwrite });
|
||||
expect(parseInvalidationEvent(JSON.stringify({
|
||||
type: "admin.updated",
|
||||
id,
|
||||
version: 8,
|
||||
operation: "overwrite",
|
||||
}))).toBeNull();
|
||||
expect(toInvalidationEvent({
|
||||
topic: `page:${id}`,
|
||||
aggregateId: id,
|
||||
eventType: "page.updated",
|
||||
payload: { id, version: 7, ...overwrite },
|
||||
})).toEqual({ type: "page.updated", id, version: 7 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user