diff --git a/superset/assets/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx b/superset/assets/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx index 7215e0859b530..d7db40a245d17 100644 --- a/superset/assets/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx +++ b/superset/assets/spec/javascripts/dashboard/components/DashboardBuilder_spec.jsx @@ -2,6 +2,7 @@ import { Provider } from 'react-redux'; import React from 'react'; import { shallow, mount } from 'enzyme'; import { expect } from 'chai'; +import sinon from 'sinon'; import ParentSize from '@vx/responsive/build/components/ParentSize'; import { Sticky, StickyContainer } from 'react-sticky'; @@ -12,6 +13,8 @@ import DashboardBuilder from '../../../../src/dashboard/components/DashboardBuil import DashboardComponent from '../../../../src/dashboard/containers/DashboardComponent'; import DashboardHeader from '../../../../src/dashboard/containers/DashboardHeader'; import DashboardGrid from '../../../../src/dashboard/containers/DashboardGrid'; +import * as dashboardStateActions from '../../../../src/dashboard/actions/dashboardState'; + import WithDragDropContext from '../helpers/WithDragDropContext'; import { dashboardLayout as undoableDashboardLayout, @@ -24,6 +27,19 @@ const dashboardLayout = undoableDashboardLayout.present; const layoutWithTabs = undoableDashboardLayoutWithTabs.present; describe('DashboardBuilder', () => { + let favStarStub; + + before(() => { + // this is invoked on mount, so we stub it instead of making a request + favStarStub = sinon + .stub(dashboardStateActions, 'fetchFaveStar') + .returns({ type: 'mock-action' }); + }); + + after(() => { + favStarStub.restore(); + }); + const props = { dashboardLayout, deleteTopLevelTabs() {}, diff --git a/superset/assets/spec/javascripts/dashboard/reducers/sliceEntities_spec.js b/superset/assets/spec/javascripts/dashboard/reducers/sliceEntities_spec.js index df43ae591d5ae..1f15d391a6b47 100644 --- a/superset/assets/spec/javascripts/dashboard/reducers/sliceEntities_spec.js +++ b/superset/assets/spec/javascripts/dashboard/reducers/sliceEntities_spec.js @@ -25,7 +25,7 @@ describe('sliceEntities reducer', () => { it('should set slices', () => { const result = sliceEntitiesReducer( { slices: { a: {} } }, - { type: SET_ALL_SLICES, slices: { 1: {}, 2: {} } }, + { type: SET_ALL_SLICES, payload: { slices: { 1: {}, 2: {} } } }, ); expect(result.slices).to.deep.equal({ @@ -41,10 +41,10 @@ describe('sliceEntities reducer', () => { {}, { type: FETCH_ALL_SLICES_FAILED, - error: { responseJSON: { message: 'errorrr' } }, + payload: { error: 'failed' }, }, ); expect(result.isLoading).to.equal(false); - expect(result.errorMessage.indexOf('errorrr')).to.be.above(-1); + expect(result.errorMessage.indexOf('failed')).to.be.above(-1); }); });