feat(i18n): localise career workspace overview
This commit is contained in:
@@ -4,6 +4,7 @@ import { render, screen, waitFor } from "@testing-library/react";
|
||||
|
||||
import { cvBuilderApi } from "./cvBuilder";
|
||||
import CareerWorkspaceOverview, { CareerWorkspaceImportRun } from "./views/career/CareerWorkspaceOverview";
|
||||
import { I18nProvider } from "./i18n/I18nProvider";
|
||||
|
||||
jest.mock("./cvBuilder", () => ({
|
||||
cvBuilderApi: { list: jest.fn() },
|
||||
@@ -25,20 +26,24 @@ function renderOverview({
|
||||
loadError?: string | null;
|
||||
} = {}) {
|
||||
return render(
|
||||
<CareerWorkspaceOverview
|
||||
completeness={{ percent, missing }}
|
||||
runs={runs}
|
||||
loading={loading}
|
||||
loadError={loadError}
|
||||
/>,
|
||||
<I18nProvider>
|
||||
<CareerWorkspaceOverview
|
||||
completeness={{ percent, missing }}
|
||||
runs={runs}
|
||||
loading={loading}
|
||||
loadError={loadError}
|
||||
/>
|
||||
</I18nProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
window.localStorage.removeItem("uiLanguage");
|
||||
mockedList.mockResolvedValue([]);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
window.localStorage.removeItem("uiLanguage");
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
@@ -55,6 +60,17 @@ test("first-run workspace presents concise profile, import, general CV and job-s
|
||||
expect(await screen.findByText("No CV documents yet.")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("career workspace overview and import state render in Bokmål", async () => {
|
||||
window.localStorage.setItem("uiLanguage", "nb");
|
||||
renderOverview({ runs: [{ id: 7, status: "pending_review" }] });
|
||||
|
||||
expect(screen.getByRole("heading", { name: "Karriereområde", level: 1 })).toBeInTheDocument();
|
||||
expect(screen.getAllByText("Se gjennom importert CV", { selector: "a" })).toHaveLength(2);
|
||||
expect(screen.getByText("Én import venter på godkjenning.")).toBeInTheDocument();
|
||||
expect(screen.getByRole("navigation", { name: "Handlinger i karriereområdet" })).toBeInTheDocument();
|
||||
expect(await screen.findByText("Ingen CV-dokumenter ennå.")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("returning workspace shows missing profile information and recent general and job-specific CVs", async () => {
|
||||
mockedList.mockResolvedValue([
|
||||
{ id: 8, name: "Backend CV", themeId: "modern", publicSlug: "backend", isPublic: false, version: 2, jobApplicationId: 42, updatedAtUtc: "2026-08-08T10:00:00Z" },
|
||||
|
||||
Reference in New Issue
Block a user