import { readFileSync } from 'fs' import { resolve } from 'path' // 契约:task.excludeTemplateInToday(模板不出现在用户今日任务列表,避免同一任务显示多条) const SVC = resolve(__dirname, '../../../cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java') const source = readFileSync(SVC, 'utf8') describe('今日任务排除模板', () => { test('getTodayTasks 查询条件排除 is_template=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(/getIsTemplate/) expect(body).toMatch(/ne\(Task::getIsTemplate, 1\)|eq\(Task::getIsTemplate, 0\)/) }) })