import { describe, expect, it } from "vitest"; import { DEFAULT_GRAPHICS_SETTINGS, ambientFillMultiplier, nextGraphicsChoice, normalizeGraphicsSettings, RENDER_SCALES, } from "./graphicsSettings"; describe("dungeon graphics settings", () => { it("keeps known choices and rejects invalid saved values", () => { expect(normalizeGraphicsSettings(DEFAULT_GRAPHICS_SETTINGS, { renderScale: 2, textureFiltering: 16, shadowQuality: "high", ambientFill: "low", })).toEqual({ renderScale: 2, textureFiltering: 16, shadowQuality: "high", ambientFill: "low" }); expect(normalizeGraphicsSettings(DEFAULT_GRAPHICS_SETTINGS, { renderScale: 5 as 2, textureFiltering: 8 as 16, shadowQuality: "ultra" as "high", })).toEqual(DEFAULT_GRAPHICS_SETTINGS); }); it("cycles all resolution choices and keeps authored ambient fill unchanged", () => { expect(nextGraphicsChoice(2, RENDER_SCALES)).toBe("adaptive"); expect(ambientFillMultiplier("authored")).toBe(1); expect(ambientFillMultiplier("low")).toBeLessThan(1); expect(ambientFillMultiplier("high")).toBeGreaterThan(1); }); });