refactor(workspace): unify application workflow

This commit is contained in:
cesnimda
2026-08-28 12:28:12 +02:00
parent 4da673ff00
commit e3f938cb42
8 changed files with 264 additions and 102 deletions
@@ -31,6 +31,10 @@ jest.mock("./components/ApplicationAssets", () => ({
ApplicationPackageDraftsSection: () => <div>Application drafts section</div>,
}));
jest.mock("./components/InterviewPrep", () => ({ ApplicationInterviewPrep: () => <div>Interview section</div> }));
jest.mock("./components/ApplicationWorkflowAssist", () => ({
ApplicationStatusSuggestion: () => <div>Status suggestion</div>,
ApplicationStrategySnapshot: () => <div>Strategy section</div>,
}));
const mockedApi = api as jest.Mocked<typeof api>;
@@ -167,9 +171,10 @@ test("opens the dedicated workspace from the whole row and preserves list state
expect(await screen.findByText("Backend Developer")).toBeInTheDocument();
expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42");
fireEvent.click(screen.getByRole("button", { name: "Match" }));
fireEvent.click(screen.getByRole("tab", { name: "Analysis" }));
expect(await screen.findByText("Analysis section")).toBeInTheDocument();
expect(await screen.findByText("Match section")).toBeInTheDocument();
expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=match");
expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=analysis");
fireEvent.click(screen.getByRole("button", { name: /back to applications/i }));
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend"));
@@ -180,7 +185,10 @@ test("opens the dedicated workspace from the whole row and preserves list state
test("opens a direct workspace URL and returns to applications", async () => {
renderTable("/jobs/42?section=match");
expect(await screen.findByText("Analysis section")).toBeInTheDocument();
expect(await screen.findByText("Match section")).toBeInTheDocument();
expect(screen.getByRole("tab", { name: "Analysis" })).toHaveAttribute("aria-selected", "true");
expect(screen.getByLabelText(/application progress: waiting/i)).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: /back to applications/i }));
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs"));
@@ -208,16 +216,16 @@ test("warns before section navigation would discard application edits", async ()
renderTable("/jobs/42?section=cover-letter");
fireEvent.click(await screen.findByRole("button", { name: "Make cover letter dirty" }));
fireEvent.click(screen.getByRole("button", { name: "Match" }));
fireEvent.click(screen.getByRole("tab", { name: "Analysis" }));
expect(await screen.findByRole("dialog", { name: /Unsaved application changes/i })).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Keep editing" }));
expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=cover-letter");
await waitFor(() => expect(screen.queryByRole("dialog", { name: /Unsaved application changes/i })).not.toBeInTheDocument());
fireEvent.click(screen.getByRole("button", { name: "Match" }));
fireEvent.click(screen.getByRole("tab", { name: "Analysis" }));
fireEvent.click(await screen.findByRole("button", { name: "Discard and leave" }));
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=match"));
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=analysis"));
});
test("hydrates list filters, sort and page from a shareable URL", async () => {