stockMove.spec.js
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { buildStockMoveImportParams } from "./buildStockMoveImportParams";
import { mapLogPagePageResponse } from "./mapLogPageResponse";
import { mapProductManagerListUpgradeGoodsSimplePageResponse } from "./mapProductManagerListUpgradeGoodsSimpleResponse";
describe("stock move adapters", () => {
it("passes the import file through without reading generated nested properties", () => {
const file = new FormData();
expect(buildStockMoveImportParams({ file })).toEqual({ file });
});
it("keeps product fields used by the remote selector", () => {
const response = mapProductManagerListUpgradeGoodsSimplePageResponse({
currentPage: 2,
list: [{ id: 9, commodityCode: "UID-9", upgradeGoodsName: "产品A" }],
});
expect(response.pageNum).toBe(2);
expect(response.list[0]).toMatchObject({
id: 9,
commodityCode: "UID-9",
upgradeGoodsName: "产品A",
});
});
it("keeps migration log fields used by the drawer", () => {
const response = mapLogPagePageResponse({
list: [{
oldCommodityCode: "OLD",
newCommodityCode: "NEW",
moveStockNum: 3,
createdBy: "张三",
createdDate: "2026-08-05 12:30:00",
}],
});
expect(response.list[0]).toEqual({
oldCommodityCode: "OLD",
newCommodityCode: "NEW",
moveStockNum: 3,
createdBy: "张三",
createdDate: "2026-08-05 12:30:00",
});
});
});