updated the dungeon loading so it doesnt fail first try
This commit is contained in:
1 parent
e39aebf3a1
commit
7e60864e70
11 files changed
+383
-69
No files matched your search
@@ -2,7 +2,8 @@ import { useGLTF } from "@react-three/drei";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { dungeonGltfUrls } from "./dungeonAssets";
|
||||
import { dungeonDefinitionById } from "./dungeonRegistry";
|
||||
import { activateDungeonSession } from "./dungeonSession";
|
||||
import { activateDungeonSession, restartActiveDungeonSession } from "./dungeonSession";
|
||||
import { usePartyStore } from "./partyStore";
|
||||
import { useGameStore } from "./store";
|
||||
|
||||
describe("dungeon session asset eviction", () => {
|
||||
@@ -28,4 +29,19 @@ describe("dungeon session asset eviction", () => {
|
||||
expect(activateDungeonSession("not-a-dungeon")).toBe(false);
|
||||
expect(clear).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("restarts the active dungeon in place while preserving its party", () => {
|
||||
const active = dungeonDefinitionById("deadmines")!;
|
||||
useGameStore.getState().activateDungeon(active.id);
|
||||
usePartyStore.getState().initializeParty("retry-party", 20, 600, "healer");
|
||||
const members = usePartyStore.getState().members.map((member) => member.id);
|
||||
const revision = useGameStore.getState().sessionRevision;
|
||||
const clear = vi.spyOn(useGLTF, "clear").mockImplementation(() => undefined);
|
||||
|
||||
expect(restartActiveDungeonSession()).toBe(true);
|
||||
|
||||
expect(clear.mock.calls.map(([url]) => url)).toEqual(dungeonGltfUrls(active));
|
||||
expect(useGameStore.getState().sessionRevision).toBe(revision + 1);
|
||||
expect(usePartyStore.getState().members.map((member) => member.id)).toEqual(members);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user