forked from molecule-ai/molecule-core
fix(canvas): resolve TS errors in test fixtures — budgetLimit and AuthGate mock types
- Add budgetLimit: null to WorkspaceNodeData fixtures in canvas-capabilities, canvas-events, canvas-events-pan, and canvas.test.ts (inline objects) - Add budget_limit: null to WorkspaceData fixtures in canvas-topology, canvas.test.ts makeWS, and ProvisioningTimeout.test.tsx - Fix AuthGate.test.tsx TS2348: cast vi.fn() mocks to explicit call signatures inside vi.mock() factories (Procedure | Constructable issue) - npx tsc --noEmit: 0 errors; 689/689 tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fef6647341
commit
67799f89da
@ -19,12 +19,14 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
vi.mock("@/lib/auth", () => ({
|
||||
fetchSession: (...args: unknown[]) => mockFetchSession(...args),
|
||||
redirectToLogin: (...args: unknown[]) => mockRedirectToLogin(...args),
|
||||
// Cast required: vi.fn() returns Mock<Procedure | Constructable> which TypeScript
|
||||
// won't call directly inside a factory closure (TS2348). Cast to Function resolves it.
|
||||
fetchSession: (...args: unknown[]) => (mockFetchSession as unknown as (...a: unknown[]) => unknown)(...args),
|
||||
redirectToLogin: (...args: unknown[]) => (mockRedirectToLogin as unknown as (...a: unknown[]) => unknown)(...args),
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/tenant", () => ({
|
||||
getTenantSlug: (...args: unknown[]) => mockGetTenantSlug(...args),
|
||||
getTenantSlug: (...args: unknown[]) => (mockGetTenantSlug as unknown as (...a: unknown[]) => unknown)(...args),
|
||||
}));
|
||||
|
||||
// Import after mocks are set up
|
||||
|
||||
@ -28,6 +28,7 @@ function makeWS(overrides: Partial<WorkspaceData> & { id: string }): WorkspaceDa
|
||||
y: 0,
|
||||
collapsed: false,
|
||||
runtime: "",
|
||||
budget_limit: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ function makeNodeData(overrides: Partial<WorkspaceNodeData> = {}): WorkspaceNode
|
||||
currentTask: "",
|
||||
needsRestart: false,
|
||||
runtime: "",
|
||||
budgetLimit: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ function makeNode(
|
||||
currentTask: "",
|
||||
needsRestart: false,
|
||||
runtime: "",
|
||||
budgetLimit: null,
|
||||
...overrides,
|
||||
},
|
||||
};
|
||||
|
||||
@ -31,6 +31,7 @@ function makeNode(
|
||||
currentTask: "",
|
||||
needsRestart: false,
|
||||
runtime: "",
|
||||
budgetLimit: null,
|
||||
...overrides,
|
||||
},
|
||||
};
|
||||
|
||||
@ -24,6 +24,7 @@ function makeWS(overrides: Partial<WorkspaceData> & { id: string }): WorkspaceDa
|
||||
y: 0,
|
||||
collapsed: false,
|
||||
runtime: "",
|
||||
budget_limit: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ function makeWS(overrides: Partial<WorkspaceData> & { id: string }): WorkspaceDa
|
||||
y: 0,
|
||||
collapsed: false,
|
||||
runtime: "",
|
||||
budget_limit: null,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
@ -172,6 +173,7 @@ describe("summarizeWorkspaceCapabilities", () => {
|
||||
currentTask: "Reviewing docs",
|
||||
needsRestart: false,
|
||||
runtime: "claude-code",
|
||||
budgetLimit: null,
|
||||
});
|
||||
|
||||
expect(summary.runtime).toBe("claude-code");
|
||||
@ -197,6 +199,7 @@ describe("summarizeWorkspaceCapabilities", () => {
|
||||
currentTask: " ",
|
||||
needsRestart: false,
|
||||
runtime: "",
|
||||
budgetLimit: null,
|
||||
});
|
||||
|
||||
expect(summary.runtime).toBeNull();
|
||||
@ -554,6 +557,7 @@ describe("context menu", () => {
|
||||
currentTask: "",
|
||||
needsRestart: false,
|
||||
runtime: "",
|
||||
budgetLimit: null,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user