test: 최신 아이콘과 동시 선택 fixture를 교정한다
This commit is contained in:
@@ -24,6 +24,7 @@ const profile = 'hwe:2';
|
|||||||
const userId = 'create-general-integration-user';
|
const userId = 'create-general-integration-user';
|
||||||
const failureUserId = 'create-general-integration-failure-user';
|
const failureUserId = 'create-general-integration-failure-user';
|
||||||
const rejectedUserId = 'create-general-integration-rejected-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 schemaName = databaseUrl ? (new URL(databaseUrl).searchParams.get('schema') ?? '') : '';
|
||||||
|
|
||||||
const assertDedicatedDatabase = (rawUrl: string): void => {
|
const assertDedicatedDatabase = (rawUrl: string): void => {
|
||||||
@@ -52,6 +53,14 @@ const buildAuth = (id: string, displayName: string, legacyMemberNo: number): Gam
|
|||||||
imageServer: 2,
|
imageServer: 2,
|
||||||
iconUpdatedAt: '2026-07-30T00:00:00.000Z',
|
iconUpdatedAt: '2026-07-30T00:00:00.000Z',
|
||||||
canUseGeneralPicture: true,
|
canUseGeneralPicture: true,
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
id: customIconId,
|
||||||
|
picture: 'custom-owner.webp',
|
||||||
|
imageServer: 2,
|
||||||
|
createdAt: '2026-07-30T00:00:00.000Z',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
sanctions: {
|
sanctions: {
|
||||||
legacyPenalty: {
|
legacyPenalty: {
|
||||||
@@ -239,6 +248,7 @@ integration('generic general creation through the durable turn daemon', () => {
|
|||||||
strength: 55,
|
strength: 55,
|
||||||
intel: 55,
|
intel: 55,
|
||||||
pic: true,
|
pic: true,
|
||||||
|
iconId: customIconId,
|
||||||
character: 'che_안전' as const,
|
character: 'che_안전' as const,
|
||||||
clientRequestId,
|
clientRequestId,
|
||||||
inheritTurntimeZone: 7,
|
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([
|
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,
|
uniqueName: firstReservation.candidates[0]!.uniqueName,
|
||||||
personality: 'che_안전',
|
personality: 'che_안전',
|
||||||
}),
|
}),
|
||||||
appRouter.createCaller(buildContext('select-pool-create-b')).join.selectPoolGeneral({
|
appRouter.createCaller(buildContext(createRequestIds[1])).join.selectPoolGeneral({
|
||||||
uniqueName: firstReservation.candidates[1]!.uniqueName,
|
uniqueName: firstReservation.candidates[1]!.uniqueName,
|
||||||
personality: 'che_유지',
|
personality: 'che_유지',
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
expect(attempts.filter((attempt) => attempt.status === 'fulfilled')).toHaveLength(1);
|
expect(attempts.filter((attempt) => attempt.status === 'fulfilled')).toHaveLength(1);
|
||||||
expect(attempts.filter((attempt) => attempt.status === 'rejected')).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 initial = await db.general.findFirstOrThrow({ where: { userId } });
|
||||||
const initialRuntime = runtime!.world.getGeneralById(initial.id);
|
const initialRuntime = runtime!.world.getGeneralById(initial.id);
|
||||||
const initialAccess = await db.generalAccessLog.findUniqueOrThrow({ where: { generalId: initial.id } });
|
const initialAccess = await db.generalAccessLog.findUniqueOrThrow({ where: { generalId: initial.id } });
|
||||||
expect(initial).toMatchObject({ picture: 'default.jpg', imageServer: 0 });
|
expect(initial).toMatchObject({ picture: 'default.jpg', imageServer: 0 });
|
||||||
const acceptedEvent = await db.inputEvent.findFirstOrThrow({
|
const acceptedEvent = await db.inputEvent.findUniqueOrThrow({
|
||||||
where: { actorUserId: userId, eventType: 'selectPoolCreate', status: 'SUCCEEDED' },
|
where: { requestId: `${successfulRequestId}:join.selectPoolGeneral` },
|
||||||
orderBy: { sequence: 'desc' },
|
});
|
||||||
|
expect(acceptedEvent).toMatchObject({
|
||||||
|
actorUserId: userId,
|
||||||
|
eventType: 'selectPoolCreate',
|
||||||
|
status: 'SUCCEEDED',
|
||||||
|
result: { type: 'selectPoolCreate', ok: true, generalId: initial.id },
|
||||||
});
|
});
|
||||||
if (!initialAccess.lastRefresh) {
|
if (!initialAccess.lastRefresh) {
|
||||||
throw new Error('selected general must have an initial access timestamp');
|
throw new Error('selected general must have an initial access timestamp');
|
||||||
|
|||||||
Reference in New Issue
Block a user