feat(workbench): refine dynamic task collaboration
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { shouldApplyWorkbenchSnapshot } from "./use-workbench-sync";
|
||||
|
||||
describe("workbench snapshot ordering", () => {
|
||||
it("rejects an older concurrent response even when its cursor is valid", () => {
|
||||
expect(shouldApplyWorkbenchSnapshot({
|
||||
requestGeneration: 1,
|
||||
latestRequestGeneration: 2,
|
||||
eventCursor: 120,
|
||||
currentCursor: 100
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects a snapshot whose cursor trails already consumed events", () => {
|
||||
expect(shouldApplyWorkbenchSnapshot({
|
||||
requestGeneration: 2,
|
||||
latestRequestGeneration: 2,
|
||||
eventCursor: 99,
|
||||
currentCursor: 100
|
||||
})).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts only the latest response without cursor rollback", () => {
|
||||
expect(shouldApplyWorkbenchSnapshot({
|
||||
requestGeneration: 2,
|
||||
latestRequestGeneration: 2,
|
||||
eventCursor: 100,
|
||||
currentCursor: 100
|
||||
})).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user