import { describe, expect, it } from "vitest";
import { normalizeDatabaseConfig } from "./database.mjs";

describe("config database helpers", () => {
  it("normalizes local database config with template defaults", () => {
    expect(
      normalizeDatabaseConfig(
        {
          database: {
            template: {
              migrate: [{ kind: "sql-file", path: "sql/migrate.sql" }],
            },
          },
        },
        "web"
      )
    ).toMatchObject({
      provider: "local",
      selectedBackend: "local",
      reset: true,
      template: {
        inputs: [],
        migrate: [{ kind: "sql-file", path: "sql/migrate.sql" }],
        seed: [],
        verify: [],
      },
    });
  });
});
