Release Healer Man 0.1.21
This commit is contained in:
1 parent
699fc858c9
commit
f6f2375145
210 files changed
+976039
-6247
No files matched your search
@@ -0,0 +1,43 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createDungeonEncounterSnapshot } from "./dungeonEncounterRuntime";
|
||||
import type { DungeonEncounterDefinition } from "./dungeonEncounterTypes";
|
||||
import {
|
||||
DUNGEON_RUN_CHECKPOINT_VERSION,
|
||||
normalizeDungeonRunCheckpoint,
|
||||
} from "./dungeonRunCheckpoint";
|
||||
|
||||
const definition: DungeonEncounterDefinition = {
|
||||
id: "test:boss",
|
||||
dungeonId: "test",
|
||||
initialPhase: "ready",
|
||||
rules: [],
|
||||
};
|
||||
|
||||
describe("dungeon run checkpoints", () => {
|
||||
it("normalizes JSON-safe encounter progress and world spawn", () => {
|
||||
const result = normalizeDungeonRunCheckpoint({
|
||||
version: DUNGEON_RUN_CHECKPOINT_VERSION,
|
||||
dungeonId: "test",
|
||||
difficultyId: "normal",
|
||||
checkpointId: "entrance",
|
||||
spawn: { footPosition: [1, 2, 3], yaw: 0.5 },
|
||||
encounters: [createDungeonEncounterSnapshot(definition)],
|
||||
savedAt: 123,
|
||||
});
|
||||
expect(result).toMatchObject({ dungeonId: "test", checkpointId: "entrance" });
|
||||
expect(result?.encounters[0]?.encounterId).toBe("test:boss");
|
||||
});
|
||||
|
||||
it("fails closed on malformed or unbounded data", () => {
|
||||
expect(normalizeDungeonRunCheckpoint({})).toBeNull();
|
||||
expect(normalizeDungeonRunCheckpoint({
|
||||
version: DUNGEON_RUN_CHECKPOINT_VERSION,
|
||||
dungeonId: "test",
|
||||
difficultyId: "normal",
|
||||
checkpointId: null,
|
||||
spawn: { footPosition: [Number.NaN, 2, 3], yaw: 0 },
|
||||
encounters: [],
|
||||
savedAt: 1,
|
||||
})).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user