/**
 * UX polish — back chevrons on /recover and /export. Both pages used to be
 * dead-ends for deep-linked users; the chevron mirrors the upload-composer
 * header pattern and routes back to /feed.
 */
import { test, expect } from '../../fixtures/test';

test.describe('Navigation — back chevrons', () => {
  test('/recover back chevron navigates to /feed (which redirects to /join when unauth)', async ({
    page,
  }) => {
    await page.goto('/recover');
    const back = page.getByTestId('recover-back');
    await expect(back).toBeVisible();
    await back.click();
    // Unauthenticated → /feed mounts and redirects to /join.
    await page.waitForURL(/\/(join|feed)$/);
  });

  test('/export back chevron returns the authenticated guest to /feed', async ({
    page,
    guest,
    signIn,
  }) => {
    const g = await guest('ExportBack');
    await signIn(page, g);
    await page.goto('/export');

    const back = page.getByTestId('export-back');
    await expect(back).toBeVisible();
    await back.click();
    await page.waitForURL('**/feed');
  });
});
