You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
import { describe, expect, it } from "vitest";
|
|
import { collectDoImportIssues } from "@/services/cc/do-confirm-gate";
|
|
|
|
describe("collectDoImportIssues", () => {
|
|
it("blocks empty or invalid container no", () => {
|
|
expect(collectDoImportIssues({ containerNo: "", filenames: ["A-DO.pdf"] }).blockers[0]).toMatch(
|
|
/柜号/,
|
|
);
|
|
expect(
|
|
collectDoImportIssues({
|
|
containerNo: "ABCD1234567",
|
|
filenames: ["A-DO.pdf"],
|
|
}).errors.containerNo,
|
|
).toMatch(/ISO 6346/);
|
|
});
|
|
|
|
it("blocks when no DO attachment", () => {
|
|
const issues = collectDoImportIssues({
|
|
containerNo: "TRHU8524770",
|
|
filenames: [],
|
|
});
|
|
expect(issues.errors.filenames).toBeTruthy();
|
|
expect(issues.blockers[0]).toMatch(/DO 附件/);
|
|
});
|
|
|
|
it("allows valid container + DO file", () => {
|
|
const issues = collectDoImportIssues({
|
|
containerNo: "TRHU8524770",
|
|
filenames: ["TRHU8524770-DO.pdf"],
|
|
});
|
|
expect(issues.blockers).toEqual([]);
|
|
expect(issues.errors).toEqual({});
|
|
});
|
|
});
|