diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-11-17 23:12:38 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-11-17 23:12:38 +0100 |
| commit | d64cf3514e5ff1ddb1c7f3ddac9a769db3e7dde0 (patch) | |
| tree | 781ec9f63220f3c15b309658e9b32ad7d9c70b3a /server/test/command | |
| parent | 94e2850fb73005f3fb30af8489905e5cdfb6fac5 (diff) | |
Phase 5: campaign meta, notes, special rules (M5)
Web:
- Note rows: create/edit menu (text, 12-swatch palette, player/monster
link with per-standee selection, delete) with the reference's
create-vs-edit commit semantics; row rendering with target-derived
gradient colour, link indent + connector, standee N:/All: prefixes,
tap-to-edit; whole-list drag-to-reorder (reorderList); quick
per-figure note (setFigureNote) from the status menu
- Special monsters: Ice Wraith "Switch Form" (deck == "Ice Wraith"
gate), summon mark toggle (round-green/summon standee artwork,
standee-nr badges, per-owner grayscale), character summon boxes +
AddSummonMenu (class summons gated by level and standee cap, item
summons from summons.json)
- Ally deck show/hide in the main menu (shouldShowAlliesDeck gate);
settings "clear unlocked" + Special Unlocks menu
- AddSectionMenu parity: search filter, findNrFromScenarioName numeric
ordering, added sections greyed + no-op, #Random Dungeon label
- gameData.ts: SummonModel, ClassData.summons, summons() fetch
Server:
- unlock_special_command_test (last command without a test; ally-deck
hide and remove-sanctuary were already covered)
PLAN.md: Phase 5 boxes checked, M5 progress-log entry
Diffstat (limited to 'server/test/command')
| -rw-r--r-- | server/test/command/unlock_special_command_test.dart | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/server/test/command/unlock_special_command_test.dart b/server/test/command/unlock_special_command_test.dart new file mode 100644 index 0000000..282f4f9 --- /dev/null +++ b/server/test/command/unlock_special_command_test.dart @@ -0,0 +1,57 @@ +import 'package:test/test.dart'; +import 'package:x_haven_server/core/commands/unlock_special_command.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +import 'test_helpers.dart'; + +void main() { + setUpAll(() async { + await setUpGame(); + }); + + // The command toggles, so normalize: start every test with "Demons" + // locked. + setUp(() { + final gs = getIt<GameState>(); + if (gs.unlockedClasses.contains('Demons')) { + UnlockSpecialCommand('Demons', gameState: gs).execute(); + } + }); + + group('UnlockSpecialCommand', () { + test('should unlock a special that is not unlocked yet', () { + final gs = getIt<GameState>(); + expect(gs.unlockedClasses.contains('Demons'), isFalse); + + UnlockSpecialCommand('Demons', gameState: gs).execute(); + + expect(gs.unlockedClasses.contains('Demons'), isTrue); + checkSaveState(); + }); + + test('should re-lock a special that is already unlocked', () { + final gs = getIt<GameState>(); + UnlockSpecialCommand('Demons', gameState: gs).execute(); + expect(gs.unlockedClasses.contains('Demons'), isTrue); + + UnlockSpecialCommand('Demons', gameState: gs).execute(); + + expect(gs.unlockedClasses.contains('Demons'), isFalse); + checkSaveState(); + }); + + test('describe should return correct strings', () { + final gs = getIt<GameState>(); + + final unlock = UnlockSpecialCommand('Demons', gameState: gs); + expect(unlock.describe(), 'Unlock Demons'); + unlock.execute(); + expect(unlock.describe(), 'Unlock Demons'); + + final lock = UnlockSpecialCommand('Demons', gameState: gs); + lock.execute(); + expect(lock.describe(), 'Lock Demons'); + }); + }); +} |
