fix: 특수 유저 커맨드의 Ref 호환 경계를 보강한다
수뇌 국가 설정과 NPC 정책을 actor-bound ENGINE mutation으로 옮기고, 추방·등용·점령·멸망·아이템 폐기의 특수 분기를 Ref와 맞춘다. 요청 ID를 사용자·프로필별로 격리하고 토너먼트 손상 projection을 fail-closed하며 실제 DB 및 Ref 차등 회귀를 보강한다.
This commit is contained in:
@@ -63,7 +63,7 @@ const buildWorld = (): InMemoryTurnWorld => {
|
||||
power: 3000,
|
||||
level: 1,
|
||||
typeCode: 'test',
|
||||
meta: {},
|
||||
meta: { notice: '통일 공지', infoText: '통일 임관 안내' },
|
||||
};
|
||||
const city: City = {
|
||||
id: 1,
|
||||
@@ -184,6 +184,7 @@ describe('persistUnificationFinalization', () => {
|
||||
const gameHistoryUpdate = vi.fn().mockResolvedValue({});
|
||||
const emperorCreate = vi.fn().mockResolvedValue({});
|
||||
const oldGeneralUpsert = vi.fn().mockResolvedValue({});
|
||||
const oldNationUpsert = vi.fn().mockResolvedValue({});
|
||||
const transaction = Object.assign({} as GamePrisma.TransactionClient, {
|
||||
$executeRaw: vi.fn().mockResolvedValue(1),
|
||||
$queryRaw: vi.fn().mockResolvedValue([]),
|
||||
@@ -233,7 +234,7 @@ describe('persistUnificationFinalization', () => {
|
||||
),
|
||||
},
|
||||
oldNation: {
|
||||
upsert: vi.fn().mockResolvedValue({}),
|
||||
upsert: oldNationUpsert,
|
||||
findMany: vi.fn().mockResolvedValue([]),
|
||||
},
|
||||
oldGeneral: { upsert: oldGeneralUpsert },
|
||||
@@ -282,6 +283,14 @@ describe('persistUnificationFinalization', () => {
|
||||
expect(gameHistoryUpdate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ data: expect.objectContaining({ winnerNation: 1 }) })
|
||||
);
|
||||
expect(oldNationUpsert).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
create: expect.objectContaining({
|
||||
nation: 1,
|
||||
data: expect.objectContaining({ msg: '통일 공지', scout_msg: '통일 임관 안내' }),
|
||||
}),
|
||||
})
|
||||
);
|
||||
expect(emperorCreate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
data: expect.objectContaining({
|
||||
|
||||
Reference in New Issue
Block a user