You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/04/21 16:46:15 UTC

[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #9602: Bump superset-ui-connection to 0.12.22

graceguo-supercat commented on a change in pull request #9602:
URL: https://github.com/apache/incubator-superset/pull/9602#discussion_r412315900



##########
File path: superset-frontend/spec/javascripts/components/AsyncSelect_spec.jsx
##########
@@ -113,28 +113,34 @@ describe('AsyncSelect', () => {
       });
     });
 
-    it('should call onAsyncError if there is an error fetching options', done => {
+    it('should call onAsyncError if there is an error fetching options', () => {
       expect.assertions(3);
 
       const errorEndpoint = 'async/error/';
       const errorGlob = 'glob:*async/error/';
       fetchMock.get(errorGlob, { throws: 'error' });
 
       const onAsyncError = jest.fn();
-      shallow(
+      const wrapper = shallow(
         <AsyncSelect
           {...mockedProps}
           dataEndpoint={errorEndpoint}
           onAsyncError={onAsyncError}
         />,
       );
 
-      setTimeout(() => {
-        expect(fetchMock.calls(errorGlob)).toHaveLength(1);
-        expect(onAsyncError.mock.calls).toHaveLength(1);
-        expect(onAsyncError).toBeCalledWith('error');
-        done();
-      });
+      return wrapper

Review comment:
       thanks for rewrite unittest. setTimeout is not the right way to test async functions :)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org