47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
const assert = require("assert");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const componentPath = path.resolve(
|
|
__dirname,
|
|
"../../src/views/ccdiCreditInfo/index.vue"
|
|
);
|
|
const detailComponentPath = path.resolve(
|
|
__dirname,
|
|
"../../src/views/ccdiCreditInfo/components/CreditInfoDetail.vue"
|
|
);
|
|
const helperPath = path.resolve(
|
|
__dirname,
|
|
"../../src/views/ccdiCreditInfo/components/creditDetailViewModel.js"
|
|
);
|
|
const source = fs.readFileSync(componentPath, "utf8");
|
|
assert(fs.existsSync(detailComponentPath), "征信详情展示组件未抽取");
|
|
const detailSource = fs.readFileSync(detailComponentPath, "utf8");
|
|
const helperSource = fs.readFileSync(helperPath, "utf8");
|
|
|
|
[
|
|
"{{ formatQueryDate(scope.row.queryDate) }}",
|
|
"normalizeCreditDetail(data, row)",
|
|
].forEach((token) => {
|
|
assert(source.includes(token), `征信时间展示缺少关键实现: ${token}`);
|
|
});
|
|
|
|
[
|
|
"formatQueryDate(value)",
|
|
"const matched = value.match(/^(",
|
|
'parseTime(value, "{y}-{m}-{d}")',
|
|
"{{ formatQueryDate(detail.queryDate) }}",
|
|
].forEach((token) => {
|
|
assert(detailSource.includes(token), `征信详情组件时间展示缺少关键实现: ${token}`);
|
|
});
|
|
|
|
[
|
|
"queryDate: data.queryDate || negativeInfo.queryDate",
|
|
"debtCount: debts.length",
|
|
"debtTotalAmount: sumDebtTotalAmount(debts)",
|
|
].forEach((token) => {
|
|
assert(helperSource.includes(token), `征信详情标准化缺少关键实现: ${token}`);
|
|
});
|
|
|
|
console.log("credit-info-date-display test passed");
|