From b41fac08c1a6199306b1b8a32d3c286a5ab2508c Mon Sep 17 00:00:00 2001 From: hided62 Date: Mon, 24 Aug 2026 09:42:25 +0000 Subject: [PATCH] =?UTF-8?q?test:=20=EC=B5=9C=EC=8B=A0=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=EA=B3=BC=20=EB=8F=99=EC=8B=9C=20=EC=84=A0=ED=83=9D=20?= =?UTF-8?q?fixture=EB=A5=BC=20=EA=B5=90=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/createGeneral.integration.test.ts | 10 ++++++++ .../test/selectPool.integration.test.ts | 24 +++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/game-api/test/createGeneral.integration.test.ts b/app/game-api/test/createGeneral.integration.test.ts index 52ff8068..1056ee91 100644 --- a/app/game-api/test/createGeneral.integration.test.ts +++ b/app/game-api/test/createGeneral.integration.test.ts @@ -24,6 +24,7 @@ const profile = 'hwe:2'; const userId = 'create-general-integration-user'; const failureUserId = 'create-general-integration-failure-user'; const rejectedUserId = 'create-general-integration-rejected-user'; +const customIconId = 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa'; const schemaName = databaseUrl ? (new URL(databaseUrl).searchParams.get('schema') ?? '') : ''; const assertDedicatedDatabase = (rawUrl: string): void => { @@ -52,6 +53,14 @@ const buildAuth = (id: string, displayName: string, legacyMemberNo: number): Gam imageServer: 2, iconUpdatedAt: '2026-07-30T00:00:00.000Z', canUseGeneralPicture: true, + icons: [ + { + id: customIconId, + picture: 'custom-owner.webp', + imageServer: 2, + createdAt: '2026-07-30T00:00:00.000Z', + }, + ], }, sanctions: { legacyPenalty: { @@ -239,6 +248,7 @@ integration('generic general creation through the durable turn daemon', () => { strength: 55, intel: 55, pic: true, + iconId: customIconId, character: 'che_안전' as const, clientRequestId, inheritTurntimeZone: 7, diff --git a/app/game-api/test/selectPool.integration.test.ts b/app/game-api/test/selectPool.integration.test.ts index 12f6da45..43c3a50f 100644 --- a/app/game-api/test/selectPool.integration.test.ts +++ b/app/game-api/test/selectPool.integration.test.ts @@ -241,26 +241,40 @@ integration('scenario 903 select pool through the durable turn daemon', () => { }, }); + const createRequestIds = ['select-pool-create-a', 'select-pool-create-b'] as const; const attempts = await Promise.allSettled([ - appRouter.createCaller(buildContext('select-pool-create-a')).join.selectPoolGeneral({ + appRouter.createCaller(buildContext(createRequestIds[0])).join.selectPoolGeneral({ uniqueName: firstReservation.candidates[0]!.uniqueName, personality: 'che_안전', }), - appRouter.createCaller(buildContext('select-pool-create-b')).join.selectPoolGeneral({ + appRouter.createCaller(buildContext(createRequestIds[1])).join.selectPoolGeneral({ uniqueName: firstReservation.candidates[1]!.uniqueName, personality: 'che_유지', }), ]); expect(attempts.filter((attempt) => attempt.status === 'fulfilled')).toHaveLength(1); expect(attempts.filter((attempt) => attempt.status === 'rejected')).toHaveLength(1); + const successfulAttemptIndex = attempts.findIndex((attempt) => attempt.status === 'fulfilled'); + if (successfulAttemptIndex < 0) { + throw new Error('one concurrent selection request must succeed'); + } + const successfulRequestId = createRequestIds[successfulAttemptIndex]; + if (!successfulRequestId) { + throw new Error('successful selection request must have a request ID'); + } const initial = await db.general.findFirstOrThrow({ where: { userId } }); const initialRuntime = runtime!.world.getGeneralById(initial.id); const initialAccess = await db.generalAccessLog.findUniqueOrThrow({ where: { generalId: initial.id } }); expect(initial).toMatchObject({ picture: 'default.jpg', imageServer: 0 }); - const acceptedEvent = await db.inputEvent.findFirstOrThrow({ - where: { actorUserId: userId, eventType: 'selectPoolCreate', status: 'SUCCEEDED' }, - orderBy: { sequence: 'desc' }, + const acceptedEvent = await db.inputEvent.findUniqueOrThrow({ + where: { requestId: `${successfulRequestId}:join.selectPoolGeneral` }, + }); + expect(acceptedEvent).toMatchObject({ + actorUserId: userId, + eventType: 'selectPoolCreate', + status: 'SUCCEEDED', + result: { type: 'selectPoolCreate', ok: true, generalId: initial.id }, }); if (!initialAccess.lastRefresh) { throw new Error('selected general must have an initial access timestamp');