[build] Bump superset-ui packages and update build (#9241)

This commit is contained in:
Erik Ritter
2020-03-05 14:20:45 -08:00
committed by GitHub
parent 4ffee8c5d1
commit 786e575dbe
9 changed files with 1708 additions and 1777 deletions

View File

@@ -18,7 +18,6 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import AnchorLink from '../../../src/components/AnchorLink';
import URLShortLinkButton from '../../../src/components/URLShortLinkButton';
@@ -41,17 +40,16 @@ describe('AnchorLink', () => {
delete global.window.location.value;
});
it('should scroll the AnchorLink into view upon mount', () => {
const callback = sinon.spy();
const clock = sinon.useFakeTimers();
const stub = sinon.stub(document, 'getElementById').returns({
it('should scroll the AnchorLink into view upon mount', async () => {
const callback = jest.fn();
const stub = jest.spyOn(document, 'getElementById').mockReturnValue({
scrollIntoView: callback,
});
shallow(<AnchorLink {...props} />);
clock.tick(2000);
expect(callback.callCount).toEqual(1);
stub.restore();
await new Promise(r => setTimeout(r, 2000));
expect(stub).toHaveBeenCalledTimes(1);
});
it('should render anchor link with id', () => {

View File

@@ -48,23 +48,21 @@ describe('FilterTooltipWrapper', () => {
expect(wrapper.find(Tooltip)).toHaveLength(1);
});
it('should show tooltip on hover', () => {
it('should show tooltip on hover', async () => {
const wrapper = setup();
wrapper.instance().isHover = true;
jest.useFakeTimers();
wrapper.find('.indicator-container').simulate('mouseover');
jest.runAllTimers();
await new Promise(r => setTimeout(r, 101));
expect(wrapper.state('show')).toBe(true);
});
it('should hide tooltip on hover', () => {
it('should hide tooltip on hover', async () => {
const wrapper = setup();
wrapper.instance().isHover = false;
jest.useFakeTimers();
wrapper.find('.indicator-container').simulate('mouseout');
jest.runAllTimers();
await new Promise(r => setTimeout(r, 101));
expect(wrapper.state('show')).toBe(false);
});
});

View File

@@ -25,7 +25,6 @@ import { now } from '../../../src/modules/dates';
describe('Timer', () => {
let wrapper;
let clock;
const mockedProps = {
endTime: null,
isRunning: true,
@@ -33,21 +32,17 @@ describe('Timer', () => {
};
beforeEach(() => {
clock = sinon.useFakeTimers();
mockedProps.startTime = now() + 1;
wrapper = mount(<Timer {...mockedProps} />);
});
afterEach(() => {
clock.restore();
});
it('is a valid element', () => {
expect(React.isValidElement(<Timer {...mockedProps} />)).toBe(true);
});
it('componentWillMount starts timer after 30ms and sets state.clockStr', () => {
it('componentWillMount starts timer after 30ms and sets state.clockStr', async () => {
expect(wrapper.state().clockStr).toBe('');
clock.tick(31);
await new Promise(r => setTimeout(r, 35));
expect(wrapper.state().clockStr).not.toBe('');
});

View File

@@ -21,7 +21,7 @@ import getClientErrorObject from '../../../src/utils/getClientErrorObject';
describe('getClientErrorObject()', () => {
it('Returns a Promise', () => {
const response = getClientErrorObject('error');
expect(response.constructor === Promise).toBe(true);
expect(response instanceof Promise).toBe(true);
});
it('Returns a Promise that resolves to an object with an error key', () => {