| 123456789101112131415161718192021 |
- import { readFileSync } from 'fs'
- import { resolve } from 'path'
- // 契约:任务过期机制(expired_at + 自动标记 overdue + 去重修复)
- const REM = resolve(__dirname, '../../../cfc-backend/src/main/java/com/etotem/cfc/task/TaskCheckinWebhookReminderTask.java')
- const SCHEMA = resolve(__dirname, '../../../cfc-backend/src/main/resources/schema.sql')
- const INIT = resolve(__dirname, '../../../cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java')
- const rem = readFileSync(REM, 'utf8'), schema = readFileSync(SCHEMA, 'utf8'), init = readFileSync(INIT, 'utf8')
- describe('任务过期机制', () => {
- test('提醒去重按 userId(与通知写入口径一致)', () => {
- expect(rem).toMatch(/alreadySentToday\(userId, task\.getId\(\), dayStart\)/)
- })
- test('expired_at 列在 schema + 迁移', () => {
- expect(schema).toMatch(/expired_at/)
- expect(init).toMatch(/expired_at/)
- })
- test('存在过期扫描调度器(每分钟)', () => {
- expect(init).toMatch(/TaskExpiry/)
- })
- })
|