Release Healer Man 0.1.11
This commit is contained in:
1 parent
5f1a14d8de
commit
13970d03c8
18 files changed
+514
-19
No files matched your search
@@ -0,0 +1,90 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { requireDungeonDefinition } from "./dungeonRegistry";
|
||||
import {
|
||||
MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES,
|
||||
partyObjectivesForNavigation,
|
||||
shouldLoadPartyNavigation,
|
||||
} from "./partyNavigationPolicy";
|
||||
import type { DungeonDefinition } from "./dungeonTypes";
|
||||
import type { ManastormStageAssetPackage } from "./manastormStageAssets";
|
||||
|
||||
function manastormPackageWithNavigationTriangles(
|
||||
triangleCount: number | undefined,
|
||||
): Pick<ManastormStageAssetPackage, "navigation"> {
|
||||
return {
|
||||
navigation: {
|
||||
id: "navigation",
|
||||
url: "/navigation.glb",
|
||||
checksum: "0".repeat(64),
|
||||
compression: "none",
|
||||
triangleCount,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function dungeonWithNavigation(
|
||||
status: DungeonDefinition["validation"]["status"],
|
||||
triangleCount: number,
|
||||
): Pick<DungeonDefinition, "assets" | "validation"> {
|
||||
return {
|
||||
assets: {
|
||||
visual: [],
|
||||
collision: [],
|
||||
navigation: { id: "navigation", fileName: "navigation.glb", triangleCount },
|
||||
},
|
||||
validation: { status, blockers: [], warnings: [] },
|
||||
};
|
||||
}
|
||||
|
||||
describe("party navigation loading policy", () => {
|
||||
it("keeps reviewed, budgeted dungeon navigation enabled", () => {
|
||||
const wailingCaverns = requireDungeonDefinition("wailing-caverns");
|
||||
|
||||
expect(shouldLoadPartyNavigation("dungeon", wailingCaverns, null)).toBe(true);
|
||||
});
|
||||
|
||||
it("does not schedule Shadowfang Keep's unvalidated oversized navigation graph", () => {
|
||||
const shadowfangKeep = requireDungeonDefinition("shadowfang-keep");
|
||||
|
||||
expect(shadowfangKeep.validation.status).toBe("unvalidated");
|
||||
expect(shadowfangKeep.assets.navigation?.triangleCount).toBeGreaterThan(
|
||||
MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES,
|
||||
);
|
||||
expect(shouldLoadPartyNavigation("dungeon", shadowfangKeep, null)).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps unvalidated regular dungeons on breadcrumb following even under budget", () => {
|
||||
expect(shouldLoadPartyNavigation(
|
||||
"dungeon",
|
||||
dungeonWithNavigation("unvalidated", 1_000),
|
||||
null,
|
||||
)).toBe(false);
|
||||
});
|
||||
|
||||
it("protects Manastorm from oversized or unmeasured synchronous graphs", () => {
|
||||
const fallbackDungeon = requireDungeonDefinition("wailing-caverns");
|
||||
|
||||
expect(shouldLoadPartyNavigation(
|
||||
"manastorm",
|
||||
fallbackDungeon,
|
||||
manastormPackageWithNavigationTriangles(MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES),
|
||||
)).toBe(true);
|
||||
expect(shouldLoadPartyNavigation(
|
||||
"manastorm",
|
||||
fallbackDungeon,
|
||||
manastormPackageWithNavigationTriangles(MAX_SYNCHRONOUS_PARTY_NAVIGATION_TRIANGLES + 1),
|
||||
)).toBe(false);
|
||||
expect(shouldLoadPartyNavigation(
|
||||
"manastorm",
|
||||
fallbackDungeon,
|
||||
manastormPackageWithNavigationTriangles(undefined),
|
||||
)).toBe(false);
|
||||
});
|
||||
|
||||
it("exposes objectives only after a usable navigation graph is ready", () => {
|
||||
const objectives = [{ id: "boss", name: "Boss", position: [1, 2, 3] as const }];
|
||||
|
||||
expect(partyObjectivesForNavigation(false, objectives)).toEqual([]);
|
||||
expect(partyObjectivesForNavigation(true, objectives)).toBe(objectives);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user