Initial catalog maker baseline

This commit is contained in:
2026-08-05 12:25:23 +02:00
commit 2e7d83b679
30 changed files with 5437 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import test from "node:test";
import assert from "node:assert/strict";
import { assertReadOnlySql } from "../src/lib/sql-readonly.js";
test("allows select statements", () => {
assert.doesNotThrow(() => assertReadOnlySql("SELECT * FROM ps_product LIMIT 1"));
});
test("blocks update statements", () => {
assert.throws(
() => assertReadOnlySql("UPDATE ps_product SET price = 0"),
/Blocked non-read-only SQL statement: UPDATE/,
);
});
test("blocks insert statements after a leading comment", () => {
assert.throws(
() => assertReadOnlySql("-- old macro query\nINSERT INTO ps_product VALUES (1)"),
/Blocked non-read-only SQL statement: INSERT/,
);
});