fix: resolve all TypeScript errors in web app
This commit is contained in:
@@ -141,7 +141,7 @@ describe("API Client", () => {
|
||||
);
|
||||
|
||||
// Verify body is not in the call
|
||||
const callArgs = mockFetch.mock.calls[0][1] as RequestInit;
|
||||
const callArgs = mockFetch.mock.calls[0]![1] as RequestInit;
|
||||
expect(callArgs.body).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { fetchTasks } from "./tasks";
|
||||
import type { Task } from "@mosaic/shared";
|
||||
import { TaskStatus, TaskPriority, type Task } from "@mosaic/shared";
|
||||
|
||||
// Mock the API client
|
||||
vi.mock("./client", () => ({
|
||||
@@ -20,8 +20,8 @@ describe("Task API Client", () => {
|
||||
id: "task-1",
|
||||
title: "Complete project setup",
|
||||
description: "Set up the development environment",
|
||||
status: "active",
|
||||
priority: "high",
|
||||
status: TaskStatus.IN_PROGRESS,
|
||||
priority: TaskPriority.HIGH,
|
||||
dueDate: new Date("2026-02-01"),
|
||||
creatorId: "user-1",
|
||||
assigneeId: "user-1",
|
||||
@@ -38,8 +38,8 @@ describe("Task API Client", () => {
|
||||
id: "task-2",
|
||||
title: "Review documentation",
|
||||
description: "Review and update project docs",
|
||||
status: "upcoming",
|
||||
priority: "medium",
|
||||
status: TaskStatus.NOT_STARTED,
|
||||
priority: TaskPriority.MEDIUM,
|
||||
dueDate: new Date("2026-02-05"),
|
||||
creatorId: "user-1",
|
||||
assigneeId: "user-1",
|
||||
@@ -72,19 +72,19 @@ describe("Task API Client", () => {
|
||||
const mockTasks: Task[] = [];
|
||||
vi.mocked(apiGet).mockResolvedValueOnce({ data: mockTasks });
|
||||
|
||||
await fetchTasks({ status: "active" });
|
||||
await fetchTasks({ status: TaskStatus.IN_PROGRESS });
|
||||
|
||||
expect(apiGet).toHaveBeenCalledWith("/api/tasks?status=active");
|
||||
expect(apiGet).toHaveBeenCalledWith("/api/tasks?status=IN_PROGRESS");
|
||||
});
|
||||
|
||||
it("should fetch tasks with multiple filters", async () => {
|
||||
const mockTasks: Task[] = [];
|
||||
vi.mocked(apiGet).mockResolvedValueOnce({ data: mockTasks });
|
||||
|
||||
await fetchTasks({ status: "active", priority: "high" });
|
||||
await fetchTasks({ status: TaskStatus.IN_PROGRESS, priority: TaskPriority.HIGH });
|
||||
|
||||
expect(apiGet).toHaveBeenCalledWith(
|
||||
"/api/tasks?status=active&priority=high"
|
||||
"/api/tasks?status=IN_PROGRESS&priority=HIGH"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user