Fix remaining MySQL tests missing SQL instances

Added SQL instance creation to remaining tests:
- Handles duplicate string column names
- Handles numeric column names and duplicates
- Handles mixed column names variations
- unsafe test
- only allows one statement
- sql() not tagged error tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2025-09-11 00:41:44 +02:00
parent f468a8b58a
commit 3dedf03182

View File

@@ -703,6 +703,7 @@ for (const image of images) {
});
test("unsafe", async () => {
await using sql = new SQL(options);
await sql`create table test (x int)`;
try {
await sql.unsafe("insert into test values (?)", [1]);
@@ -737,12 +738,14 @@ for (const image of images) {
});
test("only allows one statement", async () => {
await using sql = new SQL(options);
expect(await sql`select 1; select 2`.catch(e => e.message)).toBe(
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select 2' at line 1",
);
});
test("await sql() throws not tagged error", async () => {
await using sql = new SQL(options);
try {
await sql("select 1");
expect.unreachable();
@@ -752,6 +755,7 @@ for (const image of images) {
});
test("sql().then throws not tagged error", async () => {
await using sql = new SQL(options);
try {
await sql("select 1").then(() => {
/* noop */
@@ -763,6 +767,7 @@ for (const image of images) {
});
test("sql().catch throws not tagged error", async () => {
await using sql = new SQL(options);
try {
sql("select 1").catch(() => {
/* noop */
@@ -774,6 +779,7 @@ for (const image of images) {
});
test("sql().finally throws not tagged error", async () => {
await using sql = new SQL(options);
try {
sql("select 1").finally(() => {
/* noop */