정식 오픈 시각을 게임 시계 anchor로 전달하고, API가 실제 진행 상태와 시작 경계를 반환하게 한다. 프론트는 추가 조회 없이 경계에서 자동으로 시계를 시작한다.
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { parseProfileSeedRequest } from '../src/orchestrator/profileSeedCli.js';
|
|
|
|
describe('parseProfileSeedRequest', () => {
|
|
it('accepts the serializable selected-workspace seed contract', () => {
|
|
expect(
|
|
parseProfileSeedRequest({
|
|
scenarioId: 1010,
|
|
tickSeconds: 60,
|
|
now: '2030-01-01T00:00:00.000Z',
|
|
installOptions: {
|
|
installOperationId: 'operation-id',
|
|
installCommitSha: 'abcdef',
|
|
preopenAt: null,
|
|
openAt: '2030-01-01T02:00:00.000Z',
|
|
},
|
|
adminUser: { id: 'admin', username: 'admin' },
|
|
})
|
|
).toMatchObject({
|
|
scenarioId: 1010,
|
|
tickSeconds: 60,
|
|
installOptions: {
|
|
installOperationId: 'operation-id',
|
|
installCommitSha: 'abcdef',
|
|
openAt: '2030-01-01T02:00:00.000Z',
|
|
},
|
|
});
|
|
});
|
|
|
|
it('rejects an invalid timestamp before touching the database', () => {
|
|
expect(() => parseProfileSeedRequest({ scenarioId: 1010, now: 'not-a-date' })).toThrow(
|
|
'Profile seed now must be an ISO date-time.'
|
|
);
|
|
});
|
|
});
|