import { describe, it, expect, beforeEach } from 'vitest' import { openDb, type DB } from '../src/db' import { seedIfEmpty } from '../src/seed' import { milestoneTemplate } from '../src/repos-milestones' const FRONT_KEYS = ['enquiry', 'visit_meeting', 'quotation_sent', 'quotation_approved'] describe('seed onboarding templates (composed front + per-module tail)', () => { let db: DB beforeEach(async () => { db = openDb(':memory:'); await seedIfEmpty(db) }) it('composes the shared front with the SMS tail', async () => { const keys = (await milestoneTemplate(db, 'SMS')).map((e) => e.key) expect(keys).toEqual([ ...FRONT_KEYS, 'document_collection', 'dlt_registration', 'account_creation', 'installation', 'testing', 'training', 'go_live', 'payment_received', ]) }) it('composes the shared front with the RTGS tail ending in go-live + payment received', async () => { const keys = (await milestoneTemplate(db, 'RTGS')).map((e) => e.key) expect(keys).toEqual([ ...FRONT_KEYS, 'document_collection', 'server_checkup', 'setup_configuration', 'installation', 'testing', 'training', 'go_live', 'payment_received', ]) }) it('composes the shared front with the Mobile App tail', async () => { const keys = (await milestoneTemplate(db, 'MOBILEAPP')).map((e) => e.key) expect(keys).toEqual([ ...FRONT_KEYS, 'requirement_setup', 'configuration', 'data_import', 'installation', 'testing', 'training', 'go_live', 'payment_received', ]) }) })