건국 커맨드 구현 및 테스트 추가

This commit is contained in:
2026-01-08 16:21:15 +00:00
parent 2c541199da
commit 77185f1d49
12 changed files with 686 additions and 81 deletions
+2 -2
View File
@@ -261,12 +261,12 @@ export const reqNationGeneralCount = (min: number): Constraint => ({
export const checkNationNameDuplicate = (name: string): Constraint => ({
name: 'CheckNationNameDuplicate',
requires: () => [{ kind: 'nationList' }],
test: (_ctx, view) => {
test: (ctx, view) => {
const nations = view.get({ kind: 'nationList' }) as Nation[] | null;
if (!nations) {
return { kind: 'unknown', missing: [{ kind: 'nationList' }] };
}
if (nations.some((n) => n.name === name)) {
if (nations.some((n) => n.name === name && n.id !== ctx.nationId)) {
return { kind: 'deny', reason: '이미 존재하는 국가 이름입니다.' };
}
return allow();