33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { run, fixtures } from "./helpers.mjs";
|
|
import { join } from "node:path";
|
|
|
|
const env = { COURSE_ROOT: join(fixtures, "course") };
|
|
const audit = (ws) => run("coupling-audit.mjs", [join(fixtures, ws)], env);
|
|
|
|
test("audit_flags_card_name_in_engine", () => {
|
|
const r = audit("ws-coupled");
|
|
assert.equal(r.code, 1);
|
|
assert.match(r.out, /core\.rs:2/);
|
|
assert.match(r.out, /core\.rs:3/);
|
|
assert.match(r.out, /Baron Rivendare/);
|
|
assert.doesNotMatch(r.out, /cards\.rs/);
|
|
});
|
|
|
|
test("audit_ignores_content_dir", () => {
|
|
const r = audit("ws-content-only");
|
|
assert.equal(r.code, 0, r.out);
|
|
});
|
|
|
|
test("audit_ignores_grammar_words", () => {
|
|
const r = audit("ws-grammar");
|
|
assert.equal(r.code, 0, r.out);
|
|
});
|
|
|
|
test("audit_ignores_mechanic_words_in_real_catalog", () => {
|
|
// Uses the real course/catalog.json (no COURSE_ROOT override).
|
|
const r = run("coupling-audit.mjs", [join(fixtures, "ws-mechanics")]);
|
|
assert.equal(r.code, 0, r.out);
|
|
});
|