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");

const fileListSectionMatch = source.match(
  /<div class="file-list-section">([\s\S]*?)<el-table/
);
assert(fileListSectionMatch, "未找到上传文件列表区域");

assert(
  !/<el-select[\s\S]*?queryParams\.fileStatus/.test(fileListSectionMatch[1]),
  "上传文件列表工具栏不应再显示上传状态筛选框"
);

assert(
  /queryParams:\s*\{[\s\S]*?pageSize:\s*10\b/.test(source),
  "上传文件列表分页默认每页应为 10 条"
);

console.log("upload-data-file-list-settings test passed");
