Files
PacketStation/frontend/src/screens/admin/ChecklistsTab.test.tsx
T
spencermandClaude Opus 5.5 1cd6688247
ci / frontend (pull_request) Successful in 57s
ci / server (pull_request) Successful in 12m33s
ci / image (pull_request) Skipped
ci / e2e (pull_request) Successful in 5m4s
Build Seth's changes C1 to C11 (Gitea issues 1, 8, 18, 23, 24, 25, 27, 31, 32, 33, 36)
- C1 (issue 1): over target follows VISUAL ticket hours, not the timer.
- C2 (issue 24): a Q.C. reject always needs a reason; accept needs an NCR number after a reject without one.
- C3 (issue 25): an incomplete unit ITP blocks filing.
- C4 (issue 27): prints open the print dialog on the page, no new tab.
- C5 (issue 31): filing is blocked while VISUAL shows a work order open; the feed sets vclosed on VISUAL packets.
- C6 (issue 8): the data book leaves out the history pages.
- C7 (issue 18): the supervisor approves each received short; accept and filing wait for it.
- C8 (issue 23): per-department checklists, edited by the department supervisor or Admin, frozen at START.
- C9 (issue 32): Q.C. and Clerical may run the stamp check.
- C10 (issue 33): the PM screen and reports are for PS-ProjectMgmt and Admin only.
- C11 (issue 36): the Stall screen lists the packets assigned to the welder, at the supervisor's stall.

Migration 0011. Docs: PLAN (also issue 9 confirmed, issue 4 asked), POLICY, SECURITY, SCHEMA, FEED, README, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 13:33:51 -06:00

36 lines
1.7 KiB
TypeScript

import { fireEvent, screen, waitFor, within } from "@testing-library/react";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { adminBase } from "../../test/admin";
import { renderApp } from "../../test/auth";
import { callsTo, mockFetch } from "../../test/fetchMock";
import { memoryStorage } from "../supervisor/memoryStorage";
const ITEMS = [{ group: "Before welding", key: "dwg", text: "Drawing {drawing} Rev {rev} matches the packet" }];
beforeEach(() => {
vi.stubGlobal("localStorage", memoryStorage());
});
describe("Admin Checklists tab", () => {
it("shows the department editor on the new endpoints and links the Checklists screen", async () => {
const fetch = mockFetch({
...adminBase(),
"GET /api/checklists": {
body: [
{ dept_code: "03", dept_name: "Weld Parts", weld: true, custom: false, version: 0, editable: true },
{ dept_code: "14", dept_name: "Electrical", weld: false, custom: true, version: 2, editable: true },
],
},
"GET /api/checklists/03": {
body: { dept_code: "03", dept_name: "Weld Parts", weld: true, custom: false, version: 0, editable: true, items: ITEMS, defaults: ITEMS },
},
});
renderApp("/admin");
fireEvent.click(await screen.findByRole("tab", { name: "Checklists" }));
expect(await screen.findByLabelText("Item 1 text")).toHaveValue(ITEMS[0]?.text);
expect(within(screen.getByRole("main")).getByRole("link", { name: "Checklists" })).toHaveAttribute("href", "/checklists");
expect(screen.getByRole("combobox", { name: "Department" })).toHaveValue("03");
await waitFor(() => expect(callsTo(fetch, "GET", "/api/admin/checklists")).toHaveLength(0));
});
});