hughhhh commented on code in PR #25112: URL: https://github.com/apache/superset/pull/25112#discussion_r1320540913
########## superset-frontend/src/explore/components/SaveModal.tsx: ########## @@ -265,10 +265,10 @@ class SaveModal extends React.Component<SaveModalProps, SaveModalState> { searchParams.set('save_action', this.state.action); if (this.state.action !== 'overwrite') { searchParams.delete('form_data_key'); - } - if (this.state.action === 'saveas') { + } else { searchParams.set('slice_id', value.id.toString()); Review Comment: @justinpark + @geido so i've spent literally tons of time trying to get this test work with the current testing pattern and been having no luck. I did find that this is a known issue in enzyme when using `shallow` vs `mount` https://github.com/enzymejs/enzyme/issues/2086 What i suggest is we merge this to fix the current issue, and I can investigate on rewriting this file to work properly with RTL and i'll take full ownership over this ``` const defaultPropsTwo = { addDangerToast: jest.fn(), onHide: () => ({}), actions: { saveDataset: jest.fn().mockReturnValue({ id: 42 }), setFormData: jest.fn(), updateSlice: jest.fn().mockReturnValue({ id: 42 }), }, form_data: { datasource: '107__table', url_params: { foo: 'bar' } }, history: { replace: jest.fn(), } }; const fetchChartEndpoint = `glob:*/api/v1/chart/${1}?q=(columns:!(dashboards.id))`; beforeAll(() => { fetchMock.get(fetchDashboardsEndpoint, mockDashboardData) fetchMock.get(fetchChartEndpoint, { dashboards: [mockDashboardData]}) }); test('make sure saveOverwrite function always has slice_id attached to the url', () => { const wrapper = getWrapper(defaultPropsTwo, queryStore); const footerWrapper = shallow(wrapper.find(StyledModal).props().footer); wrapper.setState({ action: 'overwrite', }); const overwriteRadio = wrapper.find('#overwrite-radio'); overwriteRadio.simulate('click'); expect(wrapper.state().action).toBe('overwrite'); const save = footerWrapper.find('#btn_modal_save'); save.simulate('click'); expect(defaultPropsTwo.history.replace).toBeCalled() }); ``` -- 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. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org