Revert strict ModInfo.jsonSchema and cover the factorio_version error

The strict major.minor jsonSchema did not improve any consuming type (the
factorioVersion field is already typed) and only complicated the fromJSON
signature, so revert it (and drop the now-unused MajorMinorVersionSchema).
Add a test for the unparseable factorio_version branch in fromJSON.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 4.8 committed 2026-06-29 23:20:37 +00:00
1 parent e27ad5fdf9
commit 5d20f8fc84
3 files changed
+8 -13

No files matched your search

+6
View File
@@ -356,6 +356,12 @@ describe("lib/data/ModInfo", function() {
/Invalid mod version/
);
});
it("should throw for an unparseable factorio_version", function() {
assert.throws(
() => ModInfo.fromJSON({ name: "my-mod", factorio_version: "not-a-version" }),
/Invalid factorio_version/
);
});
it("should sort integer mod versions lexicographically", function() {
let unsortedVersions = ["1.0.0", "1.1.0", "0.1.0", "3.0.0", "1.2.0", "0.3.1", "0.3.3", "2.1.1", "0.0.1"];
let sortedVersions = ["0.0.1", "0.1.0", "0.3.1", "0.3.3", "1.0.0", "1.1.0", "1.2.0", "2.1.1", "3.0.0"];