Bump superset-ui-connection to 0.12.22 (#9602)

This commit is contained in:
Erik Ritter
2020-04-21 11:36:01 -07:00
committed by GitHub
parent 2b957a2c1e
commit ba691d3a27
5 changed files with 78 additions and 57 deletions

View File

@@ -113,7 +113,7 @@ 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/';
@@ -121,7 +121,7 @@ describe('AsyncSelect', () => {
fetchMock.get(errorGlob, { throws: 'error' });
const onAsyncError = jest.fn();
shallow(
const wrapper = shallow(
<AsyncSelect
{...mockedProps}
dataEndpoint={errorEndpoint}
@@ -129,12 +129,18 @@ describe('AsyncSelect', () => {
/>,
);
setTimeout(() => {
expect(fetchMock.calls(errorGlob)).toHaveLength(1);
expect(onAsyncError.mock.calls).toHaveLength(1);
expect(onAsyncError).toBeCalledWith('error');
done();
});
return wrapper
.instance()
.fetchOptions()
.then(() => {
// Fails then retries thrice whenever fetching options, which happens twice:
// once on component mount and once when calling `fetchOptions` again
expect(fetchMock.calls(errorGlob)).toHaveLength(8);
expect(onAsyncError.mock.calls).toHaveLength(2);
expect(onAsyncError).toBeCalledWith('error');
return Promise.resolve();
});
});
});
});