Update class mechanics, stat rulesets, and CoA reference catalogs

This commit is contained in:
phenom committed 2026-10-04 12:56:30 -04:00
1 parent b16821e92e
commit 39458d5de6
221 files changed
+2584962 -568

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
import test from "node:test";
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { activeCatalogPath, decodeJsonBytes, freezeJulyBaseline, julyBaselinePath, resolveBaselinePath } from "./baseline.mjs";
test("frozen July capture remains unchanged after active promotion", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "coa-baseline-"));
try {
const active = path.join(root, activeCatalogPath);
fs.mkdirSync(path.dirname(active), { recursive: true });
const original = Buffer.from(JSON.stringify({ source: { synchronizedAt: "2026-07-25T05:24:40.596Z" }, entries: [{ id: 1 }] }));
fs.writeFileSync(active, original);
assert.equal(resolveBaselinePath(root), activeCatalogPath);
const frozen = freezeJulyBaseline(root);
const bytes = fs.readFileSync(frozen);
assert.deepEqual(decodeJsonBytes(bytes, frozen), original);
fs.writeFileSync(active, '{"source":{"synchronizedAt":"2026-08-12"}}');
assert.equal(resolveBaselinePath(root), julyBaselinePath);
assert.equal(freezeJulyBaseline(root), frozen);
assert.deepEqual(fs.readFileSync(frozen), bytes);
} finally {
assert.ok(root.startsWith(`${path.resolve(os.tmpdir())}${path.sep}`));
fs.rmSync(root, { recursive: true });
}
});
test("freezing rejects a later capture rather than mislabelling it July", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "coa-baseline-"));
try {
const active = path.join(root, activeCatalogPath);
fs.mkdirSync(path.dirname(active), { recursive: true });
fs.writeFileSync(active, '{"source":{"synchronizedAt":"2026-08-12"}}');
assert.throws(() => freezeJulyBaseline(root), /not the original July/);
assert.equal(fs.existsSync(path.join(root, julyBaselinePath)), false);
} finally {
assert.ok(root.startsWith(`${path.resolve(os.tmpdir())}${path.sep}`));
fs.rmSync(root, { recursive: true });
}
});