1111
This commit is contained in:
15
backend/tests/identifiers.test.ts
Normal file
15
backend/tests/identifiers.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { assertSafeIdentifier, quoteQualifiedName } from "../src/lib/identifiers.js";
|
||||
|
||||
test("safe identifier accepts public_table", () => {
|
||||
assert.doesNotThrow(() => assertSafeIdentifier("finance_table"));
|
||||
});
|
||||
|
||||
test("safe identifier rejects SQL injection attempts", () => {
|
||||
assert.throws(() => assertSafeIdentifier("users; drop table users"));
|
||||
});
|
||||
|
||||
test("quoteQualifiedName supports schema-qualified names", () => {
|
||||
assert.equal(quoteQualifiedName("public.users"), "\"public\".\"users\"");
|
||||
});
|
||||
Reference in New Issue
Block a user