Files
healer-man/src/ui/gameplayPanelsIntegration.test.ts
T
2026-09-09 11:21:33 -04:00

51 lines
2.3 KiB
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const gameplayPanelsSource = readFileSync(
new URL("./GameplayPanels.tsx", import.meta.url),
"utf8",
);
const talentResourcesSource = readFileSync(
new URL("./talentGameplayResources.ts", import.meta.url),
"utf8",
);
const appSource = readFileSync(
new URL("../App.tsx", import.meta.url),
"utf8",
);
const gameplayResourcesSource = readFileSync(
new URL("./gameplayResources.ts", import.meta.url),
"utf8",
);
const companionPanelSource = readFileSync(
new URL("./CompanionPanel.tsx", import.meta.url),
"utf8",
);
describe("gameplay panel loading integration", () => {
it("loads talent resources behind the main-menu catalog gate, not during gameplay", () => {
expect(appSource).toContain("preloadTalentGameplayResources(talentClassId)");
expect(talentResourcesSource).toContain("loadTalentUiCatalog(classId)");
expect(talentResourcesSource).toContain("loadTalentGameplayPanel()");
expect(talentResourcesSource).toContain("image.decode()");
expect(gameplayPanelsSource).toContain("getLoadedTalentGameplayPanel()");
expect(gameplayPanelsSource).toContain("<PreloadedTalentGameplayPanel />");
expect(gameplayPanelsSource).not.toContain("requestIdleCallback");
expect(gameplayPanelsSource).not.toContain("preloadTalentGameplayResources");
expect(gameplayPanelsSource).toContain("fallback={<TalentsPanelLoading />}");
expect(gameplayPanelsSource).not.toContain("<Suspense fallback={null}><TalentGameplayPanel />");
});
it("warms the shared runtime and first-open panels before showing the main menu", () => {
expect(appSource).toContain("preloadSharedGameplayResources(originalMediaEnabled)");
expect(appSource).toContain("getLoadedGameRuntime()");
expect(gameplayResourcesSource).toContain('import("../GameRuntime")');
expect(gameplayResourcesSource).toContain('import("./PartyManagementPanel")');
expect(gameplayResourcesSource).toContain('import("./BossGuidePanel")');
expect(gameplayResourcesSource).toContain('import("./CompanionManastormPanel")');
expect(gameplayPanelsSource).toContain("<PreloadedPartyManagementPanel />");
expect(gameplayPanelsSource).toContain("<PreloadedBossGuidePanel />");
expect(companionPanelSource).toContain("<PreloadedCompanionManastormPanel");
});
});