Verify first camp sortie integrity
This commit is contained in:
@@ -133,6 +133,23 @@ try {
|
||||
),
|
||||
`Expected first camp deployment preview to keep the founding trio assigned: ${JSON.stringify(firstCampProbe.state?.sortieDeploymentPreview)}`
|
||||
);
|
||||
assert(firstCampProbe.state?.sortieHasBattle === true, `Expected first camp to expose a playable next battle: ${JSON.stringify(firstCampProbe.state)}`);
|
||||
assert(
|
||||
firstCampProbe.state?.sortieRecommendationEnabled === true,
|
||||
`Expected first camp to support recommended sortie planning: ${JSON.stringify(firstCampProbe.state)}`
|
||||
);
|
||||
assert(
|
||||
firstCampProbe.state?.sortiePlan?.selectedCount === firstCampProbe.state?.sortieDeploymentPreview?.length,
|
||||
`Expected deployment preview to match selected sortie count: ${JSON.stringify(firstCampProbe.state?.sortiePlan)} / ${JSON.stringify(firstCampProbe.state?.sortieDeploymentPreview)}`
|
||||
);
|
||||
assertUnique(
|
||||
firstCampProbe.state?.sortieDeploymentPreview?.map((slot) => slot.unitId),
|
||||
`Expected first camp deployment preview to avoid duplicate units: ${JSON.stringify(firstCampProbe.state?.sortieDeploymentPreview)}`
|
||||
);
|
||||
assertUnique(
|
||||
firstCampProbe.state?.sortieDeploymentPreview?.map((slot) => `${slot.x},${slot.y}`),
|
||||
`Expected first camp deployment preview to avoid duplicate tiles: ${JSON.stringify(firstCampProbe.state?.sortieDeploymentPreview)}`
|
||||
);
|
||||
assert(firstCampProbe.summary?.includes('보유 군자금'), `Expected camp summary to show held gold: ${JSON.stringify(firstCampProbe)}`);
|
||||
assert(firstCampProbe.texts.some((text) => text.includes('전투 보상')), `Expected camp report to show battle reward: ${JSON.stringify(firstCampProbe.texts)}`);
|
||||
assert(
|
||||
@@ -577,6 +594,12 @@ function assert(condition, message) {
|
||||
}
|
||||
}
|
||||
|
||||
function assertUnique(values, message) {
|
||||
assert(Array.isArray(values) && values.length > 0, message);
|
||||
assert(values.every(Boolean), message);
|
||||
assert(new Set(values).size === values.length, message);
|
||||
}
|
||||
|
||||
function runCommand(command, args, env = {}) {
|
||||
const result = spawnSync(command, args, { cwd: process.cwd(), env: { ...process.env, ...env }, stdio: 'inherit' });
|
||||
if (result.status !== 0) {
|
||||
|
||||
Reference in New Issue
Block a user