We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01d1dc4 commit 6aaa5bdCopy full SHA for 6aaa5bd
hooks/useLoadData/useLoadData.test.ts
@@ -442,4 +442,13 @@ describe('useLoadData', () => {
442
expect(getSuccess).toHaveBeenCalledTimes(2);
443
expect(getSuccess).toHaveBeenCalledWith('b');
444
});
445
+
446
+ it('should treat a thenable object as a Promise', async () => {
447
+ const getThenableSuccess = jest.fn(() => ({then: (resolve: any) => resolve(successResult)}));
448
449
+ const {result} = renderHook(() => useLoadData(getThenableSuccess));
450
+ expect(result.current.isInProgress).toBe(true);
451
+ await waitFor(() => expect(result.current.isInProgress).toBe(false));
452
+ expect(result.current.result).toBe(successResult);
453
+ });
454
0 commit comments