Skip to content

Commit a92435e

Browse files
committed
Add some error coverage and retry
1 parent 5186e01 commit a92435e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/react-fetch/src/__tests__/ReactFetchNode-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,18 @@ describe('ReactFetchNode', () => {
104104
});
105105
expect(outputs).toMatchObject(['banana', 'mango', 'orange']);
106106
});
107+
108+
// @gate experimental
109+
it('can produce an error', async () => {
110+
serverImpl = (req, res) => {};
111+
112+
expect.assertions(1);
113+
try {
114+
await waitForSuspense(() => {
115+
return fetch('BOOM');
116+
});
117+
} catch (err) {
118+
expect(err.message).toEqual('Invalid URL: BOOM');
119+
}
120+
});
107121
});

packages/react-suspense-test-utils/src/ReactSuspenseTestUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function waitForSuspense<T>(fn: () => T): Promise<T> {
5555
resolve(result);
5656
} catch (thrownValue) {
5757
if (typeof thrownValue.then === 'function') {
58-
thrownValue.then(retry, reject);
58+
thrownValue.then(retry, retry);
5959
} else {
6060
reject(thrownValue);
6161
}

0 commit comments

Comments
 (0)