/**
 * Vitest browser-mode setup.
 * Runs once before all tests.
 */
import { beforeAll, afterEach } from 'vitest';

// Base URL: the Vite dev server proxies /api → localhost:3003
const BASE = 'http://localhost:3002';

beforeAll(() => {
  // Ensure we're running against the local dev server
  console.log(`[setup] browser integration tests → ${BASE}`);
});

afterEach(() => {
  // Clear localStorage between tests to avoid state leakage
  // (only clear auth-related keys; keep other state if needed)
  localStorage.removeItem('token');
  localStorage.removeItem('user');
  localStorage.removeItem('permissions');
});

export { BASE };
