feat(jobs): expose discovery provenance
This commit is contained in:
@@ -8,14 +8,17 @@ import JobDiscoveryPage from "./views/JobDiscoveryPage";
|
||||
jest.mock("./api", () => ({ api: { get: jest.fn() } }));
|
||||
const mockedApi = api as jest.Mocked<typeof api>;
|
||||
|
||||
test("searches NAV and offers the existing reviewed save flow", async () => {
|
||||
mockedApi.get.mockResolvedValue({ data: [{ id: "abc", title: "Backend Developer", company: "Acme", location: "OSLO", url: "https://arbeidsplassen.nav.no/stillinger/stilling/abc", source: "nav", countryCode: "NO" }] } as any);
|
||||
test("shows honest source metadata and offers the existing reviewed save flow", async () => {
|
||||
mockedApi.get.mockResolvedValue({ data: [{ id: "abc", title: "Backend Developer", company: "Acme", location: "OSLO", modifiedAt: "2026-08-01T10:00:00Z", deadline: "2026-08-15T23:59:59Z", url: "https://arbeidsplassen.nav.no/stillinger/stilling/abc", source: "nav", sourceName: "NAV Arbeidsplassen", acquisitionType: "searched", retrievedAt: "2026-08-10T10:00:00Z", countryCode: "NO" }] } as any);
|
||||
render(<MemoryRouter future={{ v7_startTransition: true, v7_relativeSplatPath: true }}><JobDiscoveryPage /></MemoryRouter>);
|
||||
|
||||
fireEvent.change(screen.getByLabelText("Role or company"), { target: { value: "backend" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Search NAV" }));
|
||||
|
||||
expect(await screen.findByText("Backend Developer")).toBeInTheDocument();
|
||||
expect(screen.getByText("NAV Arbeidsplassen")).toBeInTheDocument();
|
||||
expect(screen.getByText(/Searched listing · Retrieved/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/Application deadline:/)).toBeInTheDocument();
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith("/job-discovery/search", { params: { q: "backend", location: undefined } }));
|
||||
expect(screen.getByRole("button", { name: "Save to tracker" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user