feat(finale): per-project presentation/Q&A durations in m:ss + config-save merge fix
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m30s
All checks were successful
Build and Push Docker Image / build (push) Successful in 7m30s
- setProjectTiming stores per-project overrides in round config; phase starts resolve: explicit input > project override > round default - Run Order rows get m:ss inputs per project; PhaseControls one-off overrides now also m:ss (shared parseClock: '7:30', '12:05', plain '7') - CRITICAL: round.update now MERGES validated form config over the existing configJson — saving the Config tab was wiping projectOrder (would have destroyed a running ceremony) and the finals-docs upload toggle Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
58
tests/unit/round-config-merge.test.ts
Normal file
58
tests/unit/round-config-merge.test.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Regression: saving the round Config form must NOT wipe operational keys that
|
||||
* live outside the form schema (ceremony projectOrder, per-project timing
|
||||
* overrides, finals-docs upload toggle). Found live: a Config save mid-test
|
||||
* destroyed the running ceremony's run order.
|
||||
*/
|
||||
import { describe, it, expect, beforeAll, afterAll } from 'vitest'
|
||||
import { prisma, createCaller } from '../setup'
|
||||
import {
|
||||
createTestUser,
|
||||
createTestProgram,
|
||||
createTestCompetition,
|
||||
createTestRound,
|
||||
cleanupTestData,
|
||||
} from '../helpers'
|
||||
import { roundRouter } from '@/server/routers/round'
|
||||
|
||||
let program: any
|
||||
let round: any
|
||||
let admin: any
|
||||
let adminCaller: ReturnType<typeof createCaller>
|
||||
|
||||
beforeAll(async () => {
|
||||
program = await createTestProgram()
|
||||
const competition = await createTestCompetition(program.id)
|
||||
round = await createTestRound(competition.id, {
|
||||
roundType: 'LIVE_FINAL',
|
||||
status: 'ROUND_ACTIVE',
|
||||
configJson: {
|
||||
presentationDurationMinutes: 5,
|
||||
projectOrder: ['p-one', 'p-two'],
|
||||
projectTimingOverrides: { 'p-one': { presentationSeconds: 480 } },
|
||||
allowFinalistRevisedUploads: true,
|
||||
},
|
||||
})
|
||||
admin = await createTestUser('SUPER_ADMIN')
|
||||
adminCaller = createCaller(roundRouter, admin)
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanupTestData(program.id, [admin.id])
|
||||
})
|
||||
|
||||
describe('round.update configJson merge', () => {
|
||||
it('updates form fields without wiping operational keys', async () => {
|
||||
await adminCaller.update({
|
||||
id: round.id,
|
||||
configJson: { presentationDurationMinutes: 10, qaDurationMinutes: 3 },
|
||||
})
|
||||
const updated = await prisma.round.findUniqueOrThrow({ where: { id: round.id } })
|
||||
const cfg = updated.configJson as Record<string, unknown>
|
||||
expect(cfg.presentationDurationMinutes).toBe(10) // form field applied
|
||||
expect(cfg.qaDurationMinutes).toBe(3)
|
||||
expect(cfg.projectOrder).toEqual(['p-one', 'p-two']) // ceremony state survives
|
||||
expect((cfg.projectTimingOverrides as any)['p-one'].presentationSeconds).toBe(480)
|
||||
expect(cfg.allowFinalistRevisedUploads).toBe(true) // finals-docs toggle survives
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user