import { existsSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { content } from "@deadhead/content"; import { describe, expect, it } from "vitest"; import { artManifest } from "../src/map/art/manifest"; const webRoot = join(dirname(fileURLToPath(import.meta.url)), ".."); describe("map art manifest (CR-003)", () => { it("has an entry for every location's and ship model's sprite and badge", () => { const keys = [ ...content.locations.flatMap((l) => [l.sprite, ...(l.badge ? [l.badge] : [])]), ...content.shipModels.map((m) => m.sprite), ]; for (const key of keys) expect(artManifest.assets, key).toHaveProperty([key]); expect(artManifest.assets).toHaveProperty(["bg"]); expect(artManifest.assets).toHaveProperty(["sun"]); }); it("names only files that exist in the source folder", () => { for (const [id, asset] of Object.entries(artManifest.assets)) { if (asset.file === null) continue; expect( existsSync(join(webRoot, artManifest.sourceDir, asset.file)), `${id}: ${asset.file}`, ).toBe(true); } }); });