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.
27 lines
987 B
27 lines
987 B
import { describe, expect, it } from "vitest";
|
|
import {
|
|
importKindLabel,
|
|
inferImportKindFromObjectKey,
|
|
normalizeExternalId,
|
|
} from "@/services/import/import-log-meta";
|
|
|
|
describe("import-log-meta", () => {
|
|
it("infers kind from object key prefix", () => {
|
|
expect(inferImportKindFromObjectKey("WO/YT1")).toBe("work_order");
|
|
expect(inferImportKindFromObjectKey("DO/TCNU")).toBe("do_upload");
|
|
expect(inferImportKindFromObjectKey("XF/ABCD")).toBe("transfer");
|
|
expect(inferImportKindFromObjectKey("TCNU4412465")).toBe("forecast");
|
|
});
|
|
|
|
it("labels kinds in Chinese", () => {
|
|
expect(importKindLabel("work_order")).toBe("工单");
|
|
expect(importKindLabel("forecast")).toBe("新增预报");
|
|
});
|
|
|
|
it("normalizes external ids and drops [object Object]", () => {
|
|
expect(normalizeExternalId("[object Object]")).toBeNull();
|
|
expect(normalizeExternalId({ F_Id: "abc-1" })).toBe("abc-1");
|
|
expect(normalizeExternalId("uuid-ok")).toBe("uuid-ok");
|
|
});
|
|
});
|