Files
docs/悦/货代SAAS平台后台/tests/verify-fba-inbound-fee-detail.cjs
T
2026-08-19 14:28:55 +08:00

32 lines
1.6 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.
#!/usr/bin/env node
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.resolve(__dirname, '..');
const moduleHtml = fs.readFileSync(path.join(root, 'prototype-src/modules/03-overseas-warehouse.html'), 'utf8');
const app = fs.readFileSync(path.join(root, 'prototype-src/app.js'), 'utf8');
const failures = [];
const expect = (condition, message) => { if (!condition) failures.push(message); };
expect(/id="fbd-inbound-fees"/.test(moduleHtml), '缺少入库单费用明细容器');
expect(/费用项目/.test(moduleHtml), '缺少费用项目表头');
expect(/币种/.test(moduleHtml), '缺少币种表头');
expect(/金额/.test(moduleHtml), '缺少金额表头');
expect(/费用合计(USD)/.test(moduleHtml), '缺少费用合计');
expect(/class="fbd-detail-table fbd-inbound-fee-table"/.test(moduleHtml), '费用表格缺少专用居中样式类');
expect(/\.fbd-inbound-fee-table th,\.fbd-inbound-fee-table td\{text-align:center!important\}/.test(moduleHtml), '费用表格内容未全部居中');
expect(/打托费/.test(app), '缺少打托费示例数据');
expect(/拆柜费/.test(app), '缺少拆柜费示例数据');
expect(/提柜费/.test(app), '缺少提柜费示例数据');
expect(/function\s+renderFbaInboundFees\s*\(/.test(app), '缺少费用明细渲染函数');
expect(/renderFbaInboundFees\(d\.fees\)/.test(app), '入库单详情未调用费用渲染');
if (failures.length) {
console.error('FBA_INBOUND_FEE_DETAIL_CHECK_FAIL');
failures.forEach(message => console.error(`- ${message}`));
process.exitCode = 1;
} else {
console.log('FBA_INBOUND_FEE_DETAIL_CHECK_PASS');
}