feat(final-docs): manual admin document-reminder blast
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,10 @@ import {
|
||||
cleanupTestData,
|
||||
uid,
|
||||
} from '../helpers'
|
||||
import { getFinalDocumentStatusForProject } from '@/server/services/final-documents'
|
||||
import {
|
||||
getFinalDocumentStatusForProject,
|
||||
sendManualFinalDocReminders,
|
||||
} from '@/server/services/final-documents'
|
||||
import * as applicantRouter from '@/server/routers/applicant'
|
||||
import { createCaller } from '../setup'
|
||||
|
||||
@@ -136,3 +139,27 @@ describe('applicant.getFinalDocumentStatus', () => {
|
||||
expect(await caller.getFinalDocumentStatus()).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('sendManualFinalDocReminders', () => {
|
||||
const localPrograms: string[] = []
|
||||
const localUsers: string[] = []
|
||||
afterAll(async () => { for (const id of localPrograms) await cleanupTestData(id, localUsers) })
|
||||
|
||||
it('sends a reminder only to finalist teams with missing required docs', async () => {
|
||||
const program = await createTestProgram()
|
||||
localPrograms.push(program.id)
|
||||
const comp = await createTestCompetition(program.id, { status: 'ACTIVE' })
|
||||
const round = await createTestRound(comp.id, { roundType: 'LIVE_FINAL', status: 'ROUND_ACTIVE', sortOrder: 6, windowCloseAt: new Date(Date.now() + 86_400_000) })
|
||||
await prisma.fileRequirement.create({ data: { id: uid('req'), roundId: round.id, name: 'Executive Summary', acceptedMimeTypes: ['application/pdf'], isRequired: true, sortOrder: 1 } })
|
||||
const project = await createTestProject(program.id)
|
||||
await createTestProjectRoundState(project.id, round.id)
|
||||
const lead = await createTestUser('APPLICANT')
|
||||
localUsers.push(lead.id)
|
||||
await prisma.teamMember.create({ data: { projectId: project.id, userId: lead.id, role: 'LEAD' } })
|
||||
|
||||
const result = await sendManualFinalDocReminders(prisma, { programId: program.id, actorId: lead.id })
|
||||
expect(result.sent).toBe(1)
|
||||
const notif = await prisma.inAppNotification.findFirst({ where: { userId: lead.id, type: 'GRAND_FINAL_DOCS_REMINDER' } })
|
||||
expect(notif).not.toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user