@@ -35,10 +35,16 @@ class IntervalSyncHarness extends MemoryManagerSyncOps {
|
35 | 35 | protected providerLifecycle = { mode: "active" as const, providerId: "test" }; |
36 | 36 | protected db = {} as DatabaseSync; |
37 | 37 | |
38 | | -constructor(intervalMinutes: number) { |
| 38 | +constructor(params: { intervalMinutes?: number; batchTimeoutMinutes?: number }) { |
39 | 39 | super(); |
40 | 40 | this.settings = { |
41 | | -sync: { intervalMinutes }, |
| 41 | +sync: { intervalMinutes: params.intervalMinutes ?? 0 }, |
| 42 | +remote: { |
| 43 | +batch: { |
| 44 | +enabled: true, |
| 45 | +timeoutMinutes: params.batchTimeoutMinutes, |
| 46 | +}, |
| 47 | +}, |
42 | 48 | } as ResolvedMemorySearchConfig; |
43 | 49 | } |
44 | 50 | |
@@ -53,6 +59,10 @@ class IntervalSyncHarness extends MemoryManagerSyncOps {
|
53 | 59 | } |
54 | 60 | } |
55 | 61 | |
| 62 | +batchConfig(): ReturnType<MemoryManagerSyncOps["resolveBatchConfig"]> { |
| 63 | +return this.resolveBatchConfig(); |
| 64 | +} |
| 65 | + |
56 | 66 | protected computeProviderKey(): string { |
57 | 67 | return "test"; |
58 | 68 | } |
@@ -85,11 +95,19 @@ describe("MemoryManagerSyncOps interval sync", () => {
|
85 | 95 | it("clamps oversized interval sync timers", () => { |
86 | 96 | vi.useFakeTimers(); |
87 | 97 | const setIntervalSpy = vi.spyOn(globalThis, "setInterval"); |
88 | | -const harness = new IntervalSyncHarness(Number.MAX_SAFE_INTEGER); |
| 98 | +const harness = new IntervalSyncHarness({ intervalMinutes: Number.MAX_SAFE_INTEGER }); |
89 | 99 | |
90 | 100 | harness.arm(); |
91 | 101 | |
92 | 102 | expect(setIntervalSpy).toHaveBeenCalledWith(expect.any(Function), MAX_TIMER_TIMEOUT_MS); |
93 | 103 | harness.stop(); |
94 | 104 | }); |
| 105 | + |
| 106 | +it("clamps oversized batch timeout minutes", () => { |
| 107 | +const harness = new IntervalSyncHarness({ |
| 108 | +batchTimeoutMinutes: Number.MAX_SAFE_INTEGER, |
| 109 | +}); |
| 110 | + |
| 111 | +expect(harness.batchConfig().timeoutMs).toBe(MAX_TIMER_TIMEOUT_MS); |
| 112 | +}); |
95 | 113 | }); |