Skip to content

test: cover mission validator contracts - #932

Merged
marceld23 merged 1 commit into
marceld23:mainfrom
ahmdkaml:test/mission-validator
Aug 11, 2026
Merged

test: cover mission validator contracts#932
marceld23 merged 1 commit into
marceld23:mainfrom
ahmdkaml:test/mission-validator

Conversation

@ahmdkaml

Copy link
Copy Markdown
Contributor

Relates to #571

Adds focused unit tests for the documented MissionValidator contracts:

  • Rejects empty mission IDs.
  • Rejects missions without objectives.
  • Rejects unsupported objective types.
  • Rejects non-positive objective and reward counts.
  • Rejects unknown objective targets and reward items.
  • Verifies Mine objectives resolve known block targets.
  • Verifies a valid mission produces no validation problems.

Copilot AI lite review requested due to automatic review settings August 11, 2026 19:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@marceld23 marceld23 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked every assertion against MissionValidator.cs and ran locally: 9/9 passing in ~1 s, Release, no warnings; CI green. There was no source-level test coverage for the validator before — good pick, since both the in-game player editor and the admin extension editor share these rules.

All seven problem-message assertions match the implementation verbatim, the Mine-resolves-blocks vs. everything-else-resolves-items branch is exercised from both sides, and the happy path pins Validate returning empty AND IsValid. The per-test Load() helper mirrors what ContentTests and the worldgen tests already do, so it fits the house style.

One recurring micro-nit (third PR in a row, so worth mentioning once): a blank line is missing between a closing method brace and the next [Fact] (here after Validate_AcceptsKnownGoodMission). dotnet format doesn't enforce it, so nothing fails — just a readability habit worth adopting. Merging.

@marceld23
marceld23 merged commit f245692 into marceld23:main Aug 11, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants