forked from phenom/healer-man
Release Healer Man 0.1.22
This commit is contained in:
1 parent
f6f2375145
commit
7f6001723a
144 files changed
+54107
-690
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import type { OnlineSharedWorld } from "../app/onlineSessionTypes";
|
||||
import {
|
||||
activateDungeonEncounterDefinitions,
|
||||
dungeonEncounterSnapshot,
|
||||
resetDungeonEncounters,
|
||||
} from "./dungeonEncounterRuntime";
|
||||
import { applySharedWorld } from "./OnlineSessionBridge";
|
||||
import { useGameStore } from "./store";
|
||||
import {
|
||||
WAILING_NARALEX_ENCOUNTER,
|
||||
useWailingEncounterStore,
|
||||
} from "./wailingCavernsEncounter";
|
||||
|
||||
const EMPTY_SHARED_WORLD = {
|
||||
dungeonId: "wailing-caverns",
|
||||
mobs: {},
|
||||
mobTransforms: {},
|
||||
partyMembers: [],
|
||||
partyPositions: {},
|
||||
partyRuntime: {
|
||||
command: "defend",
|
||||
activeMobId: null,
|
||||
objectiveBossId: null,
|
||||
memberTargetIds: {},
|
||||
},
|
||||
wailing: null,
|
||||
manastorm: null,
|
||||
} as const satisfies OnlineSharedWorld;
|
||||
|
||||
describe("online shared-world hydration", () => {
|
||||
afterEach(() => {
|
||||
useWailingEncounterStore.getState().reset("dungeon", 0);
|
||||
useGameStore.getState().activateDungeon("wailing-caverns");
|
||||
});
|
||||
|
||||
it("accepts an authority snapshot older than a follower's local revision", () => {
|
||||
activateDungeonEncounterDefinitions(
|
||||
"wailing-caverns",
|
||||
[WAILING_NARALEX_ENCOUNTER],
|
||||
"normal",
|
||||
);
|
||||
useGameStore.getState().activateDungeon("wailing-caverns");
|
||||
const authorityBase = dungeonEncounterSnapshot(WAILING_NARALEX_ENCOUNTER.id)!;
|
||||
resetDungeonEncounters("dungeon", "wailing-caverns");
|
||||
const follower = dungeonEncounterSnapshot(WAILING_NARALEX_ENCOUNTER.id)!;
|
||||
const authority = {
|
||||
...authorityBase,
|
||||
phase: "ready",
|
||||
revision: Math.max(0, follower.revision - 1),
|
||||
} as const;
|
||||
expect(authority.revision).toBeLessThan(follower.revision);
|
||||
|
||||
applySharedWorld({ ...EMPTY_SHARED_WORLD, encounters: [authority] });
|
||||
|
||||
expect(dungeonEncounterSnapshot(WAILING_NARALEX_ENCOUNTER.id)).toMatchObject({
|
||||
phase: "ready",
|
||||
revision: authority.revision,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user