import { render, screen } from '@testing-library/react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { describe, expect, it } from 'vitest';
import { Subagents } from '@/pages/Subagents';

describe('Subagents retired route', () => {
  it('redirects the old course path page to the opencode chat page', async () => {
    render(
      <MemoryRouter initialEntries={['/subagents']}>
        <Routes>
          <Route path="/subagents" element={<Subagents />} />
          <Route path="/opencode-chat" element={<div data-testid="opencode-chat-page" />} />
        </Routes>
      </MemoryRouter>,
    );

    expect(await screen.findByTestId('opencode-chat-page')).toBeInTheDocument();
    expect(screen.queryByTestId('subagents-page')).not.toBeInTheDocument();
  });
});
