Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions desktop/src/apps/NotesApp.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, screen, act, waitFor, within, fireEvent } from "@testing-library/react";
import { render, screen, act, waitFor, fireEvent } from "@testing-library/react";
import { describe, it, expect, vi, beforeEach } from "vitest";
import { NotesApp, TodoApp } from "./NotesApp";
import { NotesApp } from "./NotesApp";

function mockFetch(
resolver: (url: string, init?: RequestInit) => { ok: boolean; status?: number; body: unknown },
Expand Down Expand Up @@ -177,28 +177,3 @@ describe("NotesApp", () => {
}));
});
});

describe("TodoApp", () => {
beforeEach(() => {
vi.restoreAllMocks();
});

it("renders only lists, filtering out notes that share the same API", async () => {
vi.stubGlobal(
"fetch",
mockFetch(() => ({ ok: true, body: [noteDoc, listDoc] })),
);
render(<TodoApp windowId="w2" />);
await flush();

await waitFor(() => expect(screen.getByText("Sprint backlog")).toBeTruthy());
expect(screen.queryByText("Project kickoff")).toBeNull();
});

it("shows the todo empty state when there are no lists", async () => {
vi.stubGlobal("fetch", mockFetch(() => ({ ok: true, body: [] })));
render(<TodoApp windowId="w2" />);
await flush();
await waitFor(() => expect(screen.getByText(/no lists yet/i)).toBeTruthy());
});
});
Loading
Loading