37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { writeFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { run, copyFixture, git } from "./helpers.mjs";
|
|
|
|
function repo() {
|
|
const ws = copyFixture("ws-content-only");
|
|
git(ws, "init", "-q");
|
|
git(ws, "add", "-A");
|
|
git(ws, "commit", "-qm", "base");
|
|
git(ws, "tag", "base");
|
|
return ws;
|
|
}
|
|
|
|
test("expansion_check_rejects_engine_edit", () => {
|
|
const ws = repo();
|
|
writeFileSync(join(ws, "src/engine/core.rs"), "fn changed() {}\n");
|
|
const r = run("expansion-check.mjs", [ws, "base"]);
|
|
assert.equal(r.code, 1);
|
|
assert.match(r.out, /src\/engine\/core\.rs/);
|
|
});
|
|
|
|
test("expansion_check_rejects_new_engine_file", () => {
|
|
const ws = repo();
|
|
writeFileSync(join(ws, "src/engine/new.rs"), "fn n() {}\n");
|
|
assert.equal(run("expansion-check.mjs", [ws, "base"]).code, 1);
|
|
});
|
|
|
|
test("expansion_check_accepts_content_only", () => {
|
|
const ws = repo();
|
|
writeFileSync(join(ws, "src/content/cards.rs"), "// new card\n");
|
|
writeFileSync(join(ws, "src/content/more.rs"), "// untracked\n");
|
|
const r = run("expansion-check.mjs", [ws, "base"]);
|
|
assert.equal(r.code, 0, r.out);
|
|
});
|