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