| 123456789101112131415 |
- import { readFileSync } from 'fs'
- import { resolve } from 'path'
- // 契约:过期任务只针对跨天(deadline 日期 < 今天),当天过时段不隐藏
- const TASK = resolve(__dirname, '../../../cfc-backend/src/main/java/com/etotem/cfc/task/TaskExpiryScheduledTask.java')
- const source = readFileSync(TASK, 'utf8')
- describe('过期只跨天', () => {
- test('过期判定按 deadline 日期早于今天', () => {
- expect(source).toMatch(/ dayStart|startOfToday|before\(dayStart\)|lt\(Task::getDeadline, dayStart\)/)
- })
- test('不再用 now 直接比较 deadline(当天过时段不算过期)', () => {
- expect(source).not.toMatch(/\.le\(Task::getDeadline,\s*now\)/)
- })
- })
|