test: 최신 아이콘과 동시 선택 fixture를 교정한다

This commit is contained in:
2026-08-24 09:42:25 +00:00
parent 98db74491f
commit b41fac08c1
2 changed files with 29 additions and 5 deletions
@@ -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,
@@ -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');