Scope folder realtime refreshes by device
This commit is contained in:
@@ -39,6 +39,48 @@ test("shouldRefreshRealtimeEvent filters scoped conversation updates by project
|
||||
);
|
||||
});
|
||||
|
||||
test("shouldRefreshRealtimeEvent ignores scoped events that do not identify a project", () => {
|
||||
assert.equal(
|
||||
shouldRefreshRealtimeEvent({
|
||||
eventType: "conversation.updated",
|
||||
eventData: JSON.stringify({ deviceId: "mac-studio" }),
|
||||
projectId: "project-a",
|
||||
}),
|
||||
false,
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
shouldRefreshRealtimeEvent({
|
||||
eventType: "project.context_risk.updated",
|
||||
eventData: JSON.stringify({ deviceId: "mac-studio" }),
|
||||
projectIds: ["project-a", "project-b"],
|
||||
}),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test("shouldRefreshRealtimeEvent can match scoped device events when page opts into device scope", () => {
|
||||
assert.equal(
|
||||
shouldRefreshRealtimeEvent({
|
||||
eventType: "conversation.updated",
|
||||
eventData: JSON.stringify({ deviceId: "mac-studio" }),
|
||||
projectIds: ["project-a", "project-b"],
|
||||
deviceId: "mac-studio",
|
||||
}),
|
||||
true,
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
shouldRefreshRealtimeEvent({
|
||||
eventType: "conversation.updated",
|
||||
eventData: JSON.stringify({ deviceId: "windows-box" }),
|
||||
projectIds: ["project-a", "project-b"],
|
||||
deviceId: "mac-studio",
|
||||
}),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test("planThrottledRefresh coalesces bursts into one delayed refresh", () => {
|
||||
const state = createRefreshThrottleState();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user