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.
53 lines
1.6 KiB
53 lines
1.6 KiB
import { describe, expect, it, vi, beforeEach } from "vitest";
|
|
import { MothershipRPAProvider } from "@/workers/rpa/mothership";
|
|
import type { QuoteRequest } from "@/modules/providers/quote-provider";
|
|
|
|
describe("MothershipRPAProvider mock", () => {
|
|
beforeEach(() => {
|
|
process.env.RPA_MOCK_MODE = "true";
|
|
});
|
|
|
|
it("mock 模式返回 4 档报价", async () => {
|
|
const provider = new MothershipRPAProvider();
|
|
const req: QuoteRequest = {
|
|
cargoHash: "abc",
|
|
pickup: {
|
|
street: "1 Main",
|
|
city: "LA",
|
|
state: "CA",
|
|
zip: "90001",
|
|
placeId: "p1",
|
|
formattedAddress: "1 Main, LA, CA 90001",
|
|
selectedFromSuggestions: true,
|
|
mothershipOptionId: "ms_p1",
|
|
mothershipDisplayLabel: "1 Main, LA, CA 90001",
|
|
selectedFromMothership: true,
|
|
},
|
|
delivery: {
|
|
street: "2 Oak",
|
|
city: "Dallas",
|
|
state: "TX",
|
|
zip: "75201",
|
|
placeId: "d1",
|
|
formattedAddress: "2 Oak, Dallas, TX 75201",
|
|
selectedFromSuggestions: true,
|
|
mothershipOptionId: "ms_d1",
|
|
mothershipDisplayLabel: "2 Oak, Dallas, TX 75201",
|
|
selectedFromMothership: true,
|
|
},
|
|
weightLb: 500,
|
|
dimsIn: { l: 48, w: 40, h: 48 },
|
|
palletCount: 2,
|
|
cargoType: "general_freight",
|
|
};
|
|
|
|
const result = await provider.getQuote(req);
|
|
expect(result.items).toHaveLength(4);
|
|
expect(result.sourceType).toBe("rpa");
|
|
result.items.forEach((item) => {
|
|
expect(item.rawFreight).toBeGreaterThan(0);
|
|
expect(item.transitDays).toBeTruthy();
|
|
});
|
|
});
|
|
});
|