@@ -32,6 +32,14 @@ function configureFastJsonStatus() {
|
32 | 32 | }); |
33 | 33 | } |
34 | 34 | |
| 35 | +function firstCallArg(mock: { mock: { calls: unknown[][] } }, label: string): unknown { |
| 36 | +const arg = mock.mock.calls[0]?.[0]; |
| 37 | +if (arg === undefined) { |
| 38 | +throw new Error(`expected ${label}`); |
| 39 | +} |
| 40 | +return arg; |
| 41 | +} |
| 42 | + |
35 | 43 | beforeAll(async () => { |
36 | 44 | configureFastJsonStatus(); |
37 | 45 | ({ scanStatusJsonFast } = await loadStatusScanModuleForTest(mocks, { fastJson: true })); |
@@ -105,10 +113,10 @@ describe("scanStatusJsonFast", () => {
|
105 | 113 | await scanStatusJsonFast({}, {} as never); |
106 | 114 | |
107 | 115 | expect(mocks.getStatusSummary).toHaveBeenCalledOnce(); |
108 | | -const summaryOptions = mocks.getStatusSummary.mock.calls.at(0)?.[0] as |
109 | | -| { includeChannelSummary?: unknown } |
110 | | - | undefined; |
111 | | -expect(summaryOptions?.includeChannelSummary).toBe(false); |
| 116 | +const summaryOptions = firstCallArg(mocks.getStatusSummary, "status summary options") as { |
| 117 | +includeChannelSummary?: unknown; |
| 118 | +}; |
| 119 | +expect(summaryOptions.includeChannelSummary).toBe(false); |
112 | 120 | }); |
113 | 121 | |
114 | 122 | it("skips memory inspection for the lean status --json fast path", async () => { |
@@ -135,7 +143,9 @@ describe("scanStatusJsonFast", () => {
|
135 | 143 | }); |
136 | 144 | expect(mocks.resolveMemorySearchConfig).toHaveBeenCalled(); |
137 | 145 | expect(mocks.getMemorySearchManager).toHaveBeenCalledOnce(); |
138 | | -expect(mocks.getMemorySearchManager.mock.calls.at(0)?.[0]).toStrictEqual({ |
| 146 | +expect( |
| 147 | +firstCallArg(mocks.getMemorySearchManager, "memory search manager options"), |
| 148 | +).toStrictEqual({ |
139 | 149 | cfg: createStatusMemorySearchConfig(), |
140 | 150 | agentId: "main", |
141 | 151 | purpose: "status", |
|