Skip to content

Commit 609bdbd

Browse files
mcp-tool-shopclaude
andcommitted
test: add 5 version consistency tests
Validates semver, >= 1.0.0, CHANGELOG entry, MIT LICENSE, and marketing directory exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8f7520b commit 609bdbd

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

test/version.test.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { describe, it } from "node:test";
2+
import assert from "node:assert/strict";
3+
import { readFileSync, existsSync } from "node:fs";
4+
import { join, dirname } from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
7+
const __dirname = dirname(fileURLToPath(import.meta.url));
8+
const ROOT = join(__dirname, "..");
9+
10+
const pkg = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf-8"));
11+
const changelog = readFileSync(join(ROOT, "CHANGELOG.md"), "utf-8");
12+
13+
describe("version consistency", () => {
14+
it("version is valid semver", () => {
15+
const parts = pkg.version.split(".");
16+
assert.ok(parts.length >= 3, `Expected semver, got ${pkg.version}`);
17+
assert.ok(parts.slice(0, 3).every((p) => /^\d+$/.test(p)));
18+
});
19+
20+
it("version is >= 1.0.0", () => {
21+
const major = Number(pkg.version.split(".")[0]);
22+
assert.ok(major >= 1, `Expected major >= 1, got ${major}`);
23+
});
24+
25+
it("CHANGELOG contains current version", () => {
26+
assert.ok(
27+
changelog.includes(`[${pkg.version}]`),
28+
`CHANGELOG missing [${pkg.version}]`,
29+
);
30+
});
31+
32+
it("LICENSE exists and is MIT", () => {
33+
const license = readFileSync(join(ROOT, "LICENSE"), "utf-8");
34+
assert.ok(license.includes("MIT"));
35+
});
36+
37+
it("marketing directory exists", () => {
38+
assert.ok(existsSync(join(ROOT, "marketing")));
39+
});
40+
});

0 commit comments

Comments
 (0)