Something went wrong. Try again.
A functional toolkit for authoring resource-leveling algorithms — compose constraint and scoring blocks, enumerate feasible schedules
Something went wrong. Try again.
1.6 kB · 38 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839import { test, expect, describe } from "bun:test";
import committed from "../../generated/block-meta.json";import packageJson from "../../package.json";import { dumpBlockMeta } from "../../src/level-blocks/meta.ts";import { standardRegistry } from "../../src/level-blocks/standard.ts";
describe("generated/block-meta.json", () => { test("matches a fresh dump of the standard registry", () => { // JSON.parse(JSON.stringify(...)) drops `undefined`-valued keys and the // readonly-ness the in-memory dump carries, matching the on-disk shape. const fresh = JSON.parse( JSON.stringify(dumpBlockMeta(standardRegistry())), ) as typeof committed; expect(committed).toEqual(fresh); // If this fails, the registry (a block schema/shadow or the composition // grammar) changed: re-run `bun run scripts/generate-block-meta.ts` and // commit generated/block-meta.json. });
test("is stamped with the current levelset version and format 1", () => { const fresh = dumpBlockMeta(standardRegistry()); expect((committed as { levelsetVersion: string }).levelsetVersion).toBe( fresh.levelsetVersion, ); expect((committed as { formatVersion: number }).formatVersion).toBe(1); });
test("has a stable public JSON subpath in source and published exports", () => { expect(packageJson.exports["./block-meta.json"]).toBe( "./generated/block-meta.json", ); expect(packageJson.publishConfig.exports["./block-meta.json"]).toBe( "./generated/block-meta.json", ); expect(packageJson.files).toContain("generated"); });});