Files
ccdi/ruoyi-ui/tests/unit/upload-data-header-import-button.test.js

79 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const componentPath = path.resolve(
__dirname,
"../../src/views/ccdiProject/components/detail/UploadData.vue"
);
const source = fs.readFileSync(componentPath, "utf8");
assert(
/<div class="header-actions">[\s\S]*?@click="handleViewReport"[\s\S]*?>\s*查看报告\s*<\/el-button>[\s\S]*?@click="handleFetchBankInfo"[\s\S]*?>\s*拉取本行信息\s*<\/el-button>[\s\S]*?@click="handleOpenCreditUpload"[\s\S]*?>\s*征信导入\s*<\/el-button>/.test(
source
),
"页面右上角按钮顺序应为查看报告、拉取本行信息、征信导入"
);
assert(
/<el-button[\s\S]*?:disabled="isReportDisabled"[\s\S]*?@click="handleViewReport"[\s\S]*?>\s*查看报告\s*<\/el-button>/.test(
source
),
"查看报告按钮应绑定禁用状态"
);
assert(
/<el-button[\s\S]*?type="primary"[\s\S]*?@click="handleViewReport"[\s\S]*?>\s*查看报告\s*<\/el-button>/.test(
source
),
"查看报告按钮应为重要按钮"
);
assert(
/<el-button[\s\S]*?@click="handleOpenCreditUpload"[\s\S]*?>\s*征信导入\s*<\/el-button>/.test(
source
) &&
!/<el-button[\s\S]*?@click="handleOpenCreditUpload"[\s\S]*?type="primary"[\s\S]*?>\s*征信导入\s*<\/el-button>/.test(
source
),
"征信导入按钮应为默认样式"
);
assert(
/isReportDisabled\(\)\s*\{[\s\S]*?\["0",\s*"3"\]\.includes\(String\(this\.projectInfo\.projectStatus\)\)/.test(
source
),
"项目状态为进行中或打标中时应禁用查看报告"
);
assert(
/uploadCards:\s*\[[\s\S]*?key:\s*"transaction"[\s\S]*?btnText:\s*"上传流水"[\s\S]*?disabled:\s*false[\s\S]*?\],/.test(
source
),
"上传卡片区应只保留流水导入卡片"
);
assert(
!/key:\s*"credit"/.test(source),
"上传卡片区不应再保留征信导入卡片配置"
);
assert(
!/key:\s*"namelist"/.test(source),
"上传卡片区不应再保留名单库选择卡片配置"
);
assert(
/\.upload-cards\s*\{[\s\S]*?justify-content:\s*center;/.test(source),
"单张流水导入卡片应在上传区居中显示"
);
assert(
/\.upload-card\s*\{[\s\S]*?width:\s*420px;[\s\S]*?max-width:\s*100%;/.test(
source
),
"流水导入卡片应加宽到 420px并保持窄屏自适应"
);
console.log("upload-data-header-import-button test passed");