-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathproviderReactQuery.test.ts
More file actions
49 lines (44 loc) · 1.33 KB
/
Copy pathproviderReactQuery.test.ts
File metadata and controls
49 lines (44 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { describe, expect, it } from "vitest";
import { ThreadId } from "@okcode/contracts";
import { providerQueryKeys, checkpointDiffQueryOptions } from "./providerReactQuery";
const threadId = ThreadId.makeUnsafe("thread-1");
describe("providerQueryKeys.checkpointDiff", () => {
it("distinguishes patch and full-context file queries", () => {
const patchKey = providerQueryKeys.checkpointDiff({
threadId,
fromTurnCount: 1,
toTurnCount: 2,
relativePath: "src/a.ts",
contextMode: "patch",
});
const fullKey = providerQueryKeys.checkpointDiff({
threadId,
fromTurnCount: 1,
toTurnCount: 2,
relativePath: "src/a.ts",
contextMode: "full",
});
expect(patchKey).not.toEqual(fullKey);
});
});
describe("checkpointDiffQueryOptions", () => {
it("stays enabled for full-thread file-scoped full-context queries", () => {
const options = checkpointDiffQueryOptions({
threadId,
fromTurnCount: 0,
toTurnCount: 2,
relativePath: "src/a.ts",
contextMode: "full",
});
expect(options.queryKey).toEqual(
providerQueryKeys.checkpointDiff({
threadId,
fromTurnCount: 0,
toTurnCount: 2,
relativePath: "src/a.ts",
contextMode: "full",
}),
);
expect(options.enabled).toBe(true);
});
});