import { expect, test } from "bun:test";
import { sqlForDialect } from "../src/adapters/bunsql.ts";

test("PostgreSQL converts portable placeholders to numbered parameters", () => {
  expect(sqlForDialect("SELECT * FROM users WHERE id = ? AND status = ?", "postgres")).toBe(
    "SELECT * FROM users WHERE id = $1 AND status = $2",
  );
});

test("MySQL and parameter-free PostgreSQL statements remain unchanged", () => {
  expect(sqlForDialect("SELECT * FROM users WHERE id = ?", "mysql")).toBe(
    "SELECT * FROM users WHERE id = ?",
  );
  expect(sqlForDialect("CREATE TABLE users (id TEXT)", "postgres")).toBe(
    "CREATE TABLE users (id TEXT)",
  );
});
