TaskEarlyVisibility.contract.spec.js 901 B

12345678910111213141516171819
  1. import { readFileSync } from 'fs'
  2. import { resolve } from 'path'
  3. // 契约:task.earlyVisibility(有 earliest_start 的任务,开始前1小时才在今日列表出现)
  4. const SVC = resolve(__dirname, '../../../cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java')
  5. const source = readFileSync(SVC, 'utf8')
  6. describe('任务提前1小时可见', () => {
  7. test('getTodayTasks 按 earliest_start 提前1小时过滤显示', () => {
  8. const start = source.indexOf('public List<Task> getTodayTasks(Long memberId, String dimensionCode)')
  9. const end = source.indexOf('public List<Task> getTodayTasksByFamily')
  10. expect(start).toBeGreaterThan(-1)
  11. expect(end).toBeGreaterThan(start)
  12. const body = source.slice(start, end)
  13. expect(body).toMatch(/getEarliestStart/)
  14. expect(body).toMatch(/60 \* 60 \* 1000|HOUR_OF_DAY|HOURS/)
  15. expect(body).toMatch(/removeIf/)
  16. })
  17. })