Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(desktop): type the abort-forwarding mock and mock accessors (review follow-ups)

M2b0de51a12b0
diff --git a/desktop-app/ui/src/lib/__tests__/gfsFolderZip.test.ts b/desktop-app/ui/src/lib/__tests__/gfsFolderZip.test.ts
index 83a4aded0..a7b39a0c8 100644
--- a/desktop-app/ui/src/lib/__tests__/gfsFolderZip.test.ts
+++ b/desktop-app/ui/src/lib/__tests__/gfsFolderZip.test.ts
@@ -299,7 +299,14 @@ describe('createGfsFolderZip', () => {
it('forwards the stop signal to the producer bridge on both call kinds (R1-M1)', async () => {
const controller = new AbortController()
- const listChildren = vi.fn(() => new Promise(() => undefined))
+ const listChildren = vi.fn(
+ (
+ _resourceId: string,
+ _drive?: string,
+ _cursor?: string,
+ _options?: { signal?: AbortSignal }
+ ) => new Promise<GfsZipChildrenPage>(() => undefined)
+ )
const download = vi.fn(async () => ({ bytes: new ArrayBuffer(4) }))
const previousClerum = (window as { clerum?: unknown }).clerum
;(window as { clerum?: unknown }).clerum = { gfs: { listChildren, download } }
@@ -355,8 +362,9 @@ describe('createGfsFolderZip', () => {
expect(skipped[0]?.path.length).toBeLessThan(120)
// The walk terminated at the overflow depth instead of chasing all 110
// levels: bounded listing work, no downloads.
- expect(deps.listChildren.mock.calls.length).toBeLessThanOrEqual(110)
- expect(deps.listChildren.mock.calls.length).toBeGreaterThanOrEqual(90)
+ const listingCalls = vi.mocked(deps.listChildren).mock.calls.length
+ expect(listingCalls).toBeLessThanOrEqual(110)
+ expect(listingCalls).toBeGreaterThanOrEqual(90)
expect(deps.download).not.toHaveBeenCalled()
})