Migrate project to TypeScript and Playwright scraping

This commit is contained in:
2026-08-05 13:47:45 +02:00
parent 8ecbc6655f
commit 639d9bec75
30 changed files with 3222 additions and 1625 deletions
+22
View File
@@ -0,0 +1,22 @@
// @ts-nocheck
import test from "node:test";
import assert from "node:assert/strict";
import { assertReadOnlySql } from "../src/lib/sql-readonly.ts";
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/,
);
});