fix: serialize profile reset operations

This commit is contained in:
2026-07-31 13:19:27 +00:00
parent d959c9b06d
commit 26fbba39b4
17 changed files with 1715 additions and 378 deletions
@@ -0,0 +1,31 @@
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,
},
adminUser: { id: 'admin', username: 'admin' },
})
).toMatchObject({
scenarioId: 1010,
tickSeconds: 60,
installOptions: { installOperationId: 'operation-id', installCommitSha: 'abcdef' },
});
});
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.'
);
});
});