Add tests for undo/redo/setTempHp use cases, fix coverage thresholds
Adds missing tests for undoUseCase, redoUseCase, and setTempHpUseCase, bringing application layer coverage from ~81% to 97%. Removes autoUpdate from coverage thresholds and sets floors to actual values so they enforce a real minimum. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
import type { Encounter, PlayerCharacter } from "@initiative/domain";
|
||||
import { isDomainError } from "@initiative/domain";
|
||||
import type { EncounterStore, PlayerCharacterStore } from "../ports.js";
|
||||
import type {
|
||||
Encounter,
|
||||
PlayerCharacter,
|
||||
UndoRedoState,
|
||||
} from "@initiative/domain";
|
||||
import { EMPTY_UNDO_REDO_STATE, isDomainError } from "@initiative/domain";
|
||||
import type {
|
||||
EncounterStore,
|
||||
PlayerCharacterStore,
|
||||
UndoRedoStore,
|
||||
} from "../ports.js";
|
||||
|
||||
export function requireSaved<T>(value: T | null): T {
|
||||
if (value === null) throw new Error("Expected store.saved to be non-null");
|
||||
@@ -52,3 +60,17 @@ export function stubPlayerCharacterStore(
|
||||
};
|
||||
return stub;
|
||||
}
|
||||
|
||||
export function stubUndoRedoStore(
|
||||
initial: UndoRedoState = EMPTY_UNDO_REDO_STATE,
|
||||
): UndoRedoStore & { saved: UndoRedoState | null } {
|
||||
const stub = {
|
||||
saved: null as UndoRedoState | null,
|
||||
get: () => initial,
|
||||
save: (state: UndoRedoState) => {
|
||||
stub.saved = state;
|
||||
stub.get = () => state;
|
||||
},
|
||||
};
|
||||
return stub;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user