fix(web): update calendar and knowledge tests for real API integration (#483)
All checks were successful
ci/woodpecker/push/web Pipeline was successful
All checks were successful
ci/woodpecker/push/web Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #483.
This commit is contained in:
@@ -7,6 +7,30 @@ import * as knowledgeApi from "@/lib/api/knowledge";
|
||||
// Mock the knowledge API
|
||||
vi.mock("@/lib/api/knowledge");
|
||||
|
||||
// Mock MosaicSpinner to expose a test ID
|
||||
vi.mock("@/components/ui/MosaicSpinner", () => ({
|
||||
MosaicSpinner: ({ label }: { label?: string }): React.JSX.Element => (
|
||||
<div data-testid="loading-spinner">{label ?? "Loading..."}</div>
|
||||
),
|
||||
}));
|
||||
|
||||
// Mock elkjs since it requires APIs not available in test environment
|
||||
vi.mock("elkjs/lib/elk.bundled.js", () => ({
|
||||
default: class ELK {
|
||||
layout(graph: {
|
||||
children?: { id: string }[];
|
||||
}): Promise<{ children: { id: string; x: number; y: number }[] }> {
|
||||
return Promise.resolve({
|
||||
children: (graph.children ?? []).map((child: { id: string }, i: number) => ({
|
||||
id: child.id,
|
||||
x: i * 100,
|
||||
y: i * 100,
|
||||
})),
|
||||
});
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
// Mock Next.js router
|
||||
const mockPush = vi.fn();
|
||||
vi.mock("next/navigation", () => ({
|
||||
|
||||
Reference in New Issue
Block a user