-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test coverage for sql lab components (#3022)
- Loading branch information
Grace Guo
committed
Jun 22, 2017
1 parent
6eba6ca
commit a48e246
Showing
4 changed files
with
176 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
import React from 'react'; | ||
import configureStore from 'redux-mock-store'; | ||
import thunk from 'redux-thunk'; | ||
|
||
import { shallow } from 'enzyme'; | ||
import { describe, it } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import sinon from 'sinon'; | ||
|
||
import App from '../../../javascripts/SqlLab/components/App'; | ||
import TabbedSqlEditors from '../../../javascripts/SqlLab/components/TabbedSqlEditors'; | ||
import { sqlLabReducer } from '../../../javascripts/SqlLab/reducers'; | ||
|
||
describe('App', () => { | ||
const middlewares = [thunk]; | ||
const mockStore = configureStore(middlewares); | ||
const store = mockStore(sqlLabReducer(undefined, {})); | ||
|
||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<App />, { | ||
context: { store }, | ||
}).dive(); | ||
}); | ||
it('is valid', () => { | ||
expect(React.isValidElement(<App />)).to.equal(true); | ||
}); | ||
it('should handler resize', () => { | ||
sinon.spy(wrapper.instance(), 'getHeight'); | ||
wrapper.instance().handleResize(); | ||
expect(wrapper.instance().getHeight.callCount).to.equal(1); | ||
wrapper.instance().getHeight.restore(); | ||
}); | ||
it('should render', () => { | ||
expect(wrapper.find('.SqlLab')).to.have.length(1); | ||
expect(wrapper.find(TabbedSqlEditors)).to.have.length(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters