all-activity-status-filter.test.js 935 B

1234567891011121314151617181920212223
  1. import assert from 'node:assert/strict'
  2. import fs from 'node:fs'
  3. import path from 'node:path'
  4. import test from 'node:test'
  5. const pageFile = path.resolve('pagesHome/allActivity.vue')
  6. test('全部活动提供默认全部的活动状态筛选并映射接口状态', () => {
  7. const source = fs.readFileSync(pageFile, 'utf8')
  8. assert.match(source, /活动状态/)
  9. assert.match(source, /const status\s*=\s*ref\(['"]活动状态['"]\)/)
  10. assert.match(source, /const statusValue\s*=\s*ref\(['"]['"]\)/)
  11. assert.match(source, /statusOptions/)
  12. assert.match(source, /报名中/)
  13. assert.match(source, /报名已截止/)
  14. assert.match(source, /已结束/)
  15. assert.match(source, /activeState:\s*''/)
  16. assert.match(source, /['"]报名中['"]\s*,?\s*value:\s*1/)
  17. assert.match(source, /['"]报名已截止['"]\s*,?\s*value:\s*2/)
  18. assert.match(source, /['"]已结束['"]\s*,?\s*value:\s*3/)
  19. assert.match(source, /changeStatus/)
  20. })