fix resource transfer failure log parity
This commit is contained in:
@@ -907,6 +907,7 @@ export const createReservedTurnHandler = async (options: {
|
||||
const constraints = definition.buildConstraints(constraintCtx, actionArgs);
|
||||
const result = evaluateConstraints(constraints, constraintCtx, view);
|
||||
if (result.kind !== 'allow') {
|
||||
const failedCommandName = definition.name;
|
||||
definition = fallbackDefinition;
|
||||
actionArgs = definition.parseArgs({}) ?? {};
|
||||
actionKey = definition.key;
|
||||
@@ -914,7 +915,7 @@ export const createReservedTurnHandler = async (options: {
|
||||
const reason = result.kind === 'deny' ? result.reason : '조건을 확인할 수 없습니다.';
|
||||
blockedReason = reason;
|
||||
const meta = result.kind === 'deny' ? { constraintName: result.constraintName } : undefined;
|
||||
logs.push(createActionLog(reason, meta));
|
||||
logs.push(createActionLog(`${reason} ${failedCommandName} 실패.`, meta));
|
||||
}
|
||||
if (!usedFallback && (kind === 'general' || currentNation)) {
|
||||
const currentYearMonth = joinYearMonth(context.world.currentYear, context.world.currentMonth);
|
||||
|
||||
@@ -618,6 +618,7 @@ describe('Reserved Turn Execution Integration', () => {
|
||||
const dirty = world.consumeDirtyState();
|
||||
expect(world.getGeneralById(1)!.cityId).toBe(1);
|
||||
const denyLog = dirty.logs.find((log) => log.text.includes('같은 도시입니다.'));
|
||||
expect(denyLog?.text).toContain('이동 실패.');
|
||||
expect(denyLog?.meta?.constraintName).toBe('notSameDestCity');
|
||||
expect(dirty.logs.some((log) => log.text.includes('아무것도 실행하지 않았습니다.'))).toBe(true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user