|
|
import { describe, expect, it } from "vitest";
|
|
|
import {
|
|
|
MS_DETAILS_FIELD_TIPS,
|
|
|
MS_DETAILS_FIELD_TIPS_EN,
|
|
|
} from "@/lib/mothership/ms-details-field-tips";
|
|
|
import { MS_PIECE_COUNT_TYPES } from "@/components/mothership/mothership-logged-in-shipment-form";
|
|
|
|
|
|
describe("ms-details-field-tips", () => {
|
|
|
it("中文 tip 覆盖二级 ⓘ 字段且无官网品牌词", () => {
|
|
|
expect(MS_DETAILS_FIELD_TIPS.cargoType).toMatch(/件(Piece)/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.pieceCountType).toMatch(/包装类型/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.nmfc).toMatch(/改费|调整运费/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.freightClass).toMatch(/运费等级/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.reference).toMatch(/采购单|参考号/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.accessorials).toMatch(/附加费/);
|
|
|
expect(MS_DETAILS_FIELD_TIPS.freightReady).toMatch(/周六|周日/);
|
|
|
for (const zh of Object.values(MS_DETAILS_FIELD_TIPS)) {
|
|
|
expect(zh).not.toMatch(/MotherShip|Mothership/i);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
it("英文原文与官网截图一致(货物类型 / 件数类型 / NMFC)", () => {
|
|
|
expect(MS_DETAILS_FIELD_TIPS_EN.cargoType).toBe(
|
|
|
"Select how you are shipping your cargo. Loose item has been renamed to Piece.",
|
|
|
);
|
|
|
expect(MS_DETAILS_FIELD_TIPS_EN.pieceCountType).toBe(
|
|
|
"Select the packaging type of your cargo contents. This is usually different than your cargo type.",
|
|
|
);
|
|
|
expect(MS_DETAILS_FIELD_TIPS_EN.nmfc).toBe(
|
|
|
"Add this code to mitigate potential carrier adjustment charges.",
|
|
|
);
|
|
|
expect(MS_DETAILS_FIELD_TIPS_EN.accessorials).toBe(
|
|
|
"Select services to avoid accessorial fees.",
|
|
|
);
|
|
|
});
|
|
|
|
|
|
it("件数类型选项十余项且含 Pieces/Cartons", () => {
|
|
|
expect(MS_PIECE_COUNT_TYPES.length).toBeGreaterThanOrEqual(15);
|
|
|
expect(MS_PIECE_COUNT_TYPES.map((t) => t.id)).toEqual(
|
|
|
expect.arrayContaining(["Pieces", "Cartons", "Units", "Boxes", "Drums"]),
|
|
|
);
|
|
|
});
|
|
|
});
|