import { setupTestDatabase, teardownTestDatabase } from "./helpers/dbSetup.js";

/**
 * Vitest Global Setup
 * This runs once before all test files
 */
export async function setup() {
  console.log("\n🚀 Running global test setup...");
  try {
    await setupTestDatabase();
    console.log("✅ Global test setup complete\n");
  } catch (error) {
    console.error("❌ Global test setup failed:", error);
    throw error;
  }
}

/**
 * Vitest Global Teardown
 * This runs once after all test files complete
 */
export async function teardown() {
  console.log("\n🛑 Running global test teardown...");
  try {
    await teardownTestDatabase();
    console.log("✅ Global test teardown complete\n");
  } catch (error) {
    console.error("❌ Global test teardown failed:", error);
    throw error;
  }
}
