import { describe, it, expect } from 'vitest';

/**
 * Auth + caching behavior for RootLayout and Dashboard.
 *
 * These tests assert that:
 * - RootLayout is marked dynamic so it re-evaluates cookies per request.
 * - DashboardPage is also dynamic (no static caching of auth state).
 */

describe('RootLayout auth caching behavior', () => {
  it('is configured as dynamic to avoid static auth caching', async () => {
    const layoutModule = (await import(
      '../../../../apps/website/app/layout',
    )) as { dynamic?: string };
 
    // Next.js dynamic routing flag
    const dynamic = layoutModule.dynamic;

    expect(dynamic).toBe('force-dynamic');
  });
});

describe('Dashboard auth caching behavior', () => {
  it('is configured as dynamic to evaluate auth per request', async () => {
    const dashboardModule = (await import(
      '../../../../apps/website/app/dashboard/page',
    )) as { dynamic?: string };
 
    const dynamic = dashboardModule.dynamic;

    expect(dynamic).toBe('force-dynamic');
  });
});