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

47 lines
1.6 KiB
JavaScript

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="list-toolbar">[\s\S]*?<div class="toolbar-actions">[\s\S]*?@click="handleOpenBatchUploadDialog"[\s\S]*?>\s*上传流水\s*<\/el-button>[\s\S]*?@click="handleFetchBankInfo"[\s\S]*?>\s*拉取本行信息\s*<\/el-button>[\s\S]*?@click="handleGoCreditInfoPage"[\s\S]*?>\s*征信导入\s*<\/el-button>[\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="handleOpenBatchUploadDialog"[\s\S]*?>\s*上传流水\s*<\/el-button>/.test(
source
) &&
!/<el-button[\s\S]*?type="primary"[\s\S]*?@click="handleOpenBatchUploadDialog"[\s\S]*?>\s*上传流水\s*<\/el-button>/.test(
source
),
"上传流水按钮应为默认样式"
);
assert(
!/class="content-header"/.test(source) &&
!/\.content-header\s*\{/.test(source),
"页面标题卡片和相关样式应已移除"
);
assert(
!/uploadCards:/.test(source) && !/class="upload-cards"/.test(source),
"上传卡片数据和模板应已清理"
);
console.log("upload-data-header-import-button test passed");