Skip to content

Commit b877ff1

Browse files
wobsorianoaustincalvelage
authored andcommitted
test(expo): wait for native bootstrap before asserting 401 recovery (#9502)
1 parent 1a3ca4d commit b877ff1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.changeset/soft-poems-repeat.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/expo/src/provider/__tests__/ClerkProvider.nativeClientSync.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,11 @@ describe('ClerkProvider native client sync', () => {
15641564
expect(mocks.clerkInstance.handleUnauthenticated).not.toBe(originalHandleUnauthenticated);
15651565
});
15661566

1567+
// Bootstrap's suppressed device token write would swallow the rotation below.
1568+
await act(async () => {
1569+
await waitForPendingJsToNativeSync();
1570+
});
1571+
15671572
// Drop the client fetches the bootstrap already made; only the 401 handling matters here.
15681573
fetchClient.mockClear();
15691574

@@ -1618,6 +1623,11 @@ describe('ClerkProvider native client sync', () => {
16181623
expect(mocks.clerkInstance.handleUnauthenticated).not.toBe(originalHandleUnauthenticated);
16191624
});
16201625

1626+
// Bootstrap fetches the client too, and that fetch fails here, so drain its retries first.
1627+
await act(async () => {
1628+
await expect(waitForPendingJsToNativeSync()).rejects.toThrow('stale session 401');
1629+
});
1630+
16211631
fetchClient.mockClear();
16221632

16231633
await act(async () => {

0 commit comments

Comments
 (0)