Skip to content

Commit 9201cbe

Browse files
test(web): settle AuthProvider before Volunteer tests return
Three synchronous tests returned while AuthProvider's /api/auth/me fetch was still in flight, so its state update landed outside act() and warned on every run. Each now awaits the settled DOM the way the fourth test already does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdRwHvDupRLV8GuJpYKzEr
1 parent 12dea00 commit 9201cbe

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎apps/web/tests/Volunteer.test.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,34 @@ describe('Volunteer', () => {
4343
);
4444
}
4545

46-
it('renders the hero headline', () => {
46+
it('renders the hero headline', async () => {
4747
renderVolunteer();
4848
expect(
4949
screen.getByRole('heading', {
5050
name: /volunteer with code for philly/i,
5151
level: 1,
5252
}),
5353
).toBeInTheDocument();
54+
// Let AuthProvider's /api/auth/me fetch settle before the test returns.
55+
await screen.findByText(/browse 268 active projects/i);
5456
});
5557

56-
it('points "When we meet →" at the live Meetup group, not the dead GitBook page', () => {
58+
it('points "When we meet →" at the live Meetup group, not the dead GitBook page', async () => {
5759
renderVolunteer();
5860
const link = screen.getByRole('link', { name: /when we meet/i });
5961
expect(link).toHaveAttribute('href', MEETUP_URL);
6062
expect(link).toHaveAttribute('target', '_blank');
6163
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
64+
await screen.findByText(/browse 268 active projects/i);
6265
});
6366

64-
it('points "Read the guide →" at the partnerships repo, not the dead GitBook page', () => {
67+
it('points "Read the guide →" at the partnerships repo, not the dead GitBook page', async () => {
6568
renderVolunteer();
6669
const link = screen.getByRole('link', { name: /read the guide/i });
6770
expect(link).toHaveAttribute('href', START_PROJECT_URL);
6871
expect(link).toHaveAttribute('target', '_blank');
6972
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
73+
await screen.findByText(/browse 268 active projects/i);
7074
});
7175

7276
it('has no codeforphilly.gitbook.io links anywhere on the screen', async () => {

0 commit comments

Comments
 (0)