betodealmeida commented on a change in pull request #8060: SIP-23: Persist SQL Lab state in the backend URL: https://github.com/apache/incubator-superset/pull/8060#discussion_r319344408
########## File path: superset/assets/spec/javascripts/sqllab/reducers/sqlLab_spec.js ########## @@ -19,96 +19,119 @@ import sqlLabReducer from '../../../../src/SqlLab/reducers/sqlLab'; import * as actions from '../../../../src/SqlLab/actions/sqlLab'; import { table, initialState as mockState } from '../fixtures'; +import { now } from '../../../../src/modules/dates'; const initialState = mockState.sqlLab; describe('sqlLabReducer', () => { - describe('CLONE_QUERY_TO_NEW_TAB', () => { - const testQuery = { sql: 'SELECT * FROM...', dbId: 1, id: 'flasj233' }; - let newState = { - ...initialState, - queries: { [testQuery.id]: testQuery }, - }; - beforeEach(() => { - newState = sqlLabReducer(newState, actions.cloneQueryToNewTab(testQuery)); - }); - - it('should have at most one more tab', () => { - expect(newState.queryEditors).toHaveLength(2); - }); - - it('should have the same SQL as the cloned query', () => { - expect(newState.queryEditors[1].sql).toBe(testQuery.sql); - }); - - it('should prefix the new tab title with "Copy of"', () => { - expect(newState.queryEditors[1].title).toContain('Copy of'); - }); - - it('should push the cloned tab onto tab history stack', () => { - expect(newState.tabHistory[1]).toBe(newState.queryEditors[1].id); - }); - }); describe('Query editors actions', () => { let newState; let defaultQueryEditor; let qe; beforeEach(() => { newState = { ...initialState }; defaultQueryEditor = newState.queryEditors[0]; - qe = Object.assign({}, defaultQueryEditor); - newState = sqlLabReducer(newState, actions.addQueryEditor(qe)); - qe = newState.queryEditors[newState.queryEditors.length - 1]; + const action = { Review comment: I changed a lot (all?) of the unit tests to be proper unit tests, removing the call to `actions`. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org