Skip to content

Commit e4d9a99

Browse files
committed
Merge remote-tracking branch 'origin/main' into live-stream-drain-204
2 parents da2ee2e + 508f243 commit e4d9a99

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/test/pages/SharedPage.test.tsx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeEach, describe, expect, it, vi } from 'vitest';
2-
import { render, screen } from '@testing-library/react';
2+
import { render, screen, waitFor } from '@testing-library/react';
33
import { MemoryRouter, Route, Routes } from 'react-router-dom';
44
import { AuthContext, type AuthContextValue } from '@/lib/supabase/auth-context';
55
import SharedPage from '@/pages/SharedPage';
@@ -54,8 +54,11 @@ describe('a missing share link', () => {
5454
expect(screen.queryByRole('heading', { name: 'Shared Content' })).not.toBeInTheDocument();
5555
expect(screen.getByText('This shared content is no longer available')).toBeInTheDocument();
5656
expect(screen.getByRole('link', { name: 'Back to home' })).toHaveAttribute('href', '/');
57-
expect(document.title).toBe('Shared link not found · DebateLab');
58-
expect(document.head.querySelector('meta[name="robots"]')?.getAttribute('content')).toBe('noindex, nofollow');
57+
// The heading commits before the passive effect that sets the title and robots meta runs.
58+
await waitFor(() => expect(document.title).toBe('Shared link not found · DebateLab'));
59+
await waitFor(() =>
60+
expect(document.head.querySelector('meta[name="robots"]')?.getAttribute('content')).toBe('noindex, nofollow'),
61+
);
5962
});
6063

6164
it('still shows a shared item that exists', async () => {

0 commit comments

Comments
 (0)