activity-edit-category.test.js 526 B

1234567891011121314
  1. import test from 'node:test'
  2. import assert from 'node:assert/strict'
  3. import fs from 'node:fs'
  4. import path from 'node:path'
  5. const addFile = path.resolve('src/views/modules/activity/add.vue')
  6. test('活动编辑页使用字符串分类 ID,避免雪花 ID 精度丢失导致下拉无法回显', () => {
  7. const source = fs.readFileSync(addFile, 'utf8')
  8. assert.match(source, /:value="String\(item\.id\)"/)
  9. assert.match(source, /map\(id\s*=>\s*String\(id\)\.trim\(\)\)/)
  10. assert.doesNotMatch(source, /\.map\(Number\)/)
  11. })