productId.integration.spec.js
2.25 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const fs = require("fs");
const path = require("path");
const SOURCE_ROOT = path.resolve(__dirname, "../../../../src");
function readSource(file) {
return fs.readFileSync(path.resolve(SOURCE_ROOT, file), "utf8");
}
describe("purchase and transfer approval product ID coverage", () => {
it.each([
"views/purchase/procurementReview.vue",
"views/purchase/managerReview.vue",
"views/purchase/directorReview.vue",
"views/purchase/procurementBusiness.vue",
"views/stockManage/transferOperationsReview/index.vue",
"views/stockManage/transferCommercialReview/index.vue",
])("adds the product ID filter to %s", (file) => {
const source = readSource(file);
expect(source).toContain("commodityCode: \"");
expect(source).toContain("createProductIdFilter()");
});
it.each([
"views/purchase/components/orderDetailDialog.vue",
"views/purchase/components/CheckDialog.vue",
"views/purchase/components/rejectDialog.vue",
"views/purchase/singleReview.vue",
"views/purchase/singleBusinessReview.vue",
"views/stockManage/components/transferDetailDialog.vue",
"views/stockManage/transferOperationsReview/handleReview.vue",
"views/stockManage/transferOperationsReview/handleReject.vue",
])("adds the product ID column to %s", (file) => {
const source = readSource(file);
const tableConfig = source.slice(source.indexOf("tableColumns:"));
const productNameIndex = Math.max(
tableConfig.indexOf("label: \"产品名称\""),
tableConfig.indexOf("label: '产品名称'"),
);
const productIdIndex = tableConfig.indexOf("createProductIdColumn()");
expect(productNameIndex).toBeGreaterThanOrEqual(0);
expect(productIdIndex).toBeGreaterThan(productNameIndex);
});
it.each([
"views/stockManage/transferOperationsReview/index.vue",
"views/stockManage/transferCommercialReview/index.vue",
])("keeps product ID in the reset model for %s", (file) => {
const source = readSource(file);
expect(source.match(/commodityCode: ""/g)).toHaveLength(2);
});
it("keeps the film-roll column anchored before the car column", () => {
const detailSource = readSource("views/purchase/components/orderDetailDialog.vue");
expect(detailSource).toContain("item => item.prop === \"carName\"");
expect(detailSource).not.toContain("tableColumns.splice(5, 0");
});
});