31 lines
990 B
TypeScript
31 lines
990 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { MemoryRouter } from "react-router-dom";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { App } from "../app/App";
|
|
|
|
describe("App", () => {
|
|
it("renders the shell after dev bootstrap", async () => {
|
|
vi.stubGlobal(
|
|
"fetch",
|
|
vi.fn()
|
|
.mockResolvedValueOnce(new Response(JSON.stringify({ authenticated: true, dev_mode: true }), { status: 200 }))
|
|
.mockResolvedValueOnce(
|
|
new Response(
|
|
JSON.stringify({
|
|
profile: { primary_display_name: "Anna Müller" },
|
|
sections: { needs_me: [], today: [], changed: [], official_updates: [], catch_up: [] },
|
|
connections: []
|
|
}),
|
|
{ status: 200 }
|
|
)
|
|
)
|
|
);
|
|
render(
|
|
<MemoryRouter initialEntries={["/"]}>
|
|
<App />
|
|
</MemoryRouter>
|
|
);
|
|
expect(await screen.findByText("What needs attention")).toBeInTheDocument();
|
|
});
|
|
});
|