Files
Portfolio/tests/unit/districts.test.ts

33 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { DISTRICT_PRESENCE } from "@/scene/world/districts";
const provenance = JSON.parse(
readFileSync("assets/blender/districts/nightdrive-districts.asset.json", "utf8"),
) as { pieces: string[]; triangles: number };
describe("roadside districts", () => {
it("raises every authored piece in at least one chapter and nothing else", () => {
expect(Object.keys(DISTRICT_PRESENCE).sort()).toEqual(provenance.pieces);
for (const presence of Object.values(DISTRICT_PRESENCE)) {
const strengths = Object.values(presence);
expect(strengths.length).toBeGreaterThan(0);
for (const strength of strengths) {
expect(strength).toBeGreaterThan(0);
expect(strength).toBeLessThanOrEqual(1);
}
}
});
it("keeps the opening and the destination clear of mid-route districts", () => {
for (const [piece, presence] of Object.entries(DISTRICT_PRESENCE)) {
expect(presence.start, piece).toBeUndefined();
if (piece !== "arch") expect(presence.contact, piece).toBeUndefined();
}
});
it("stays a light kit", () => {
expect(provenance.triangles).toBeLessThan(8000);
});
});