Files
healer-man/src/scene/WorldNpcPrompt.test.ts
T
2026-09-09 22:18:15 -04:00

24 lines
991 B
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import {
WORLD_NPC_PROMPT_MAX_DISTANCE,
worldNpcPromptIsInRange,
} from "./WorldNpcPrompt";
describe("world NPC prompts", () => {
it("limits prompts to nearby players", () => {
expect(worldNpcPromptIsInRange([0, 0, 0], [0, 0, WORLD_NPC_PROMPT_MAX_DISTANCE])).toBe(true);
expect(worldNpcPromptIsInRange([0, 0, 0], [0, 0, WORLD_NPC_PROMPT_MAX_DISTANCE + 0.01])).toBe(false);
});
it("uses geometry occlusion and is the Naralex prompt path", () => {
const promptSource = readFileSync(new URL("./WorldNpcPrompt.tsx", import.meta.url), "utf8");
const naralexSource = readFileSync(new URL("./WailingNaralexEvent.tsx", import.meta.url), "utf8");
expect(promptSource).toContain("<DungeonOccludedHtml");
expect(promptSource).not.toContain('occlude="raycast"');
expect(naralexSource).toContain("<WorldNpcPrompt");
expect(naralexSource).not.toContain("<Html");
});
});