test: 시계 릴리스 게이트와 격리 fixture 완성
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
const databaseUrl = process.env.INPUT_EVENT_DATABASE_URL;
|
||||
const integration = describe.skipIf(!databaseUrl);
|
||||
const journalGeneralIds = [9_980_081, 9_980_082] as const;
|
||||
const clockScenarioCode = 'input-event-boundary';
|
||||
|
||||
const journalBoundaryRouter = router({
|
||||
mutate: procedure
|
||||
@@ -56,6 +57,21 @@ integration('API input event boundary', () => {
|
||||
await db.readModelRevision.deleteMany({
|
||||
where: { domain: 'front.general', entityId: { in: [...journalGeneralIds] } },
|
||||
});
|
||||
await db.worldState.deleteMany({ where: { scenarioCode: clockScenarioCode } });
|
||||
const base = new Date('2099-09-03T00:00:00.000Z');
|
||||
await db.worldState.create({
|
||||
data: {
|
||||
scenarioCode: clockScenarioCode,
|
||||
currentYear: 200,
|
||||
currentMonth: 1,
|
||||
tickSeconds: 600,
|
||||
clockBaseTime: base,
|
||||
clockTick: 0n,
|
||||
clockMode: 'realtime',
|
||||
clockWallAnchor: base,
|
||||
clockPhase: 'RUNNING',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -68,6 +84,7 @@ integration('API input event boundary', () => {
|
||||
await db.readModelRevision.deleteMany({
|
||||
where: { domain: 'front.general', entityId: { in: [...journalGeneralIds] } },
|
||||
});
|
||||
await db.worldState.deleteMany({ where: { scenarioCode: clockScenarioCode } });
|
||||
await close?.();
|
||||
});
|
||||
|
||||
|
||||
@@ -15,6 +15,20 @@ integration('database command queue', () => {
|
||||
let close: (() => Promise<void>) | undefined;
|
||||
let db: GamePrismaClient;
|
||||
|
||||
const cleanupFixtures = async (): Promise<void> => {
|
||||
await db.inputEvent.deleteMany({ where: { requestId: { startsWith: 'integration:engine:' } } });
|
||||
await db.clockProjectionOutbox.deleteMany({
|
||||
where: { suspensionId: { in: ['integration-queue-revision-8-9', 'integration-unification-wait'] } },
|
||||
});
|
||||
await db.clockSuspension.deleteMany({
|
||||
where: { id: { in: ['integration-queue-revision-8-9', 'integration-unification-wait'] } },
|
||||
});
|
||||
await db.message.deleteMany({ where: { mailbox: 991_199 } });
|
||||
await db.worldState.deleteMany({
|
||||
where: { scenarioCode: { in: ['queue-clock-test', 'queue-unification-clock-test'] } },
|
||||
});
|
||||
};
|
||||
|
||||
beforeAll(async () => {
|
||||
const connector = createGamePostgresConnector({ url: databaseUrl! });
|
||||
await connector.connect();
|
||||
@@ -25,22 +39,10 @@ integration('database command queue', () => {
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await db.inputEvent.deleteMany({ where: { requestId: { startsWith: 'integration:engine:' } } });
|
||||
await db.clockProjectionOutbox.deleteMany({
|
||||
where: { suspensionId: { in: ['integration-queue-revision-8-9', 'integration-unification-wait'] } },
|
||||
});
|
||||
await db.clockSuspension.deleteMany({
|
||||
where: { id: { in: ['integration-queue-revision-8-9', 'integration-unification-wait'] } },
|
||||
});
|
||||
await db.message.deleteMany({ where: { mailbox: 991_199 } });
|
||||
await db.worldState.updateMany({ data: { clockPhase: 'RUNNING' } });
|
||||
});
|
||||
beforeEach(cleanupFixtures);
|
||||
|
||||
afterAll(async () => {
|
||||
await db.inputEvent.deleteMany({
|
||||
where: { requestId: { startsWith: 'integration:engine:' } },
|
||||
});
|
||||
await cleanupFixtures();
|
||||
await close?.();
|
||||
});
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ export default defineConfig({
|
||||
'scenario/gameCancellation': 'src/scenario/gameCancellation.ts',
|
||||
'scenario/scenarioSeeder': 'src/scenario/scenarioSeeder.ts',
|
||||
'scenario/unitSetLoader': 'src/scenario/unitSetLoader.ts',
|
||||
'turn/clockProjectionOutbox': 'src/turn/clockProjectionOutbox.ts',
|
||||
'turn/clockReconciliation': 'src/turn/clockReconciliation.ts',
|
||||
'turn/databaseHooks': 'src/turn/databaseHooks.ts',
|
||||
'turn/inMemoryWorld': 'src/turn/inMemoryWorld.ts',
|
||||
'turn/monthlyDisasterAction': 'src/turn/monthlyDisasterAction.ts',
|
||||
|
||||
Reference in New Issue
Block a user