import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' const root = new URL('../src/views/m/crm/customer/', import.meta.url) const [list, detail, filters, attachments, fields, styles] = await Promise.all([ readFile(new URL('index.vue', root), 'utf8'), readFile(new URL('detail.vue', root), 'utf8'), readFile(new URL('CustomerFilters.vue', root), 'utf8'), readFile(new URL('CustomerAttachments.vue', root), 'utf8'), readFile(new URL('CustomerFields.vue', root), 'utf8'), readFile(new URL('customer.scss', root), 'utf8') ]) for (const component of [ 'MpBusinessHeader', 'MpStatusTabs', 'MpThreeColumnFilters', 'MpExpenseCard' ]) { assert.match(list, new RegExp(`<${component}\\b`), `客户列表应使用 ${component}`) } const headerAt = list.indexOf('= 0 && headerAt < tabsAt && tabsAt < filtersAt && filtersAt < cardAt) assert.doesNotMatch( list, /class="mp-customer-actions"[\s\S]*+ 新增[\s\S]*筛选[\s\S]*显示[\s\S]*刷新/ ) assert.match(list, /class="mp-wv-speed-dial"/) assert.match(list, /class="mp-customer-batch-bar"/) assert.match(list, /requestSnapshot/) assert.match(list, /onKeywordUpdate/) assert.match(list, /customerTypeIn/) assert.match(list, /levelIn/) assert.match(list, /:show-actions="!selectMode"/, '选择模式必须隐藏卡片动作栏') assert.match(list, /rows\.value = \[\]/, 'reset 请求必须先清空旧列表') assert.match(list, /total\.value = 0/, 'reset 请求必须先清空旧总数') assert.match(list, /selected\.value = \[\]/, 'reset 请求必须先清空旧选择') assert.match(list, /customerCardTime\(row\)/, '客户卡时间必须支持 lastTime/createTime 回退') assert.match(detail, /关键词业务视图 0"/, '上传期间必须禁止再次选择文件') assert.match(attachments, /if \(uploading\.value > 0\)/, '上传处理器必须拒绝并发选择') assert.match( attachments, /existing\.push\(url\)[\s\S]*emit\('update:modelValue', existing\.join\(','\)\)/, '每个文件成功后必须立即保留并提交引用' ) assert.match(attachments, /ElMessage\.error\(/, '后续文件上传失败必须给出反馈') assert.doesNotMatch(fields, /