tests pass again
This commit is contained in:
parent
6eccfe05ef
commit
4acfe495c0
1 changed files with 19 additions and 13 deletions
|
@ -7,39 +7,45 @@ import { shallow } from 'enzyme'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
|
|
||||||
describe('ImportDialogBox', function() {
|
describe('ImportDialogBox', function() {
|
||||||
|
const csvExport = sinon.spy()
|
||||||
|
const jsonExport = sinon.spy()
|
||||||
|
const onExport = format => () => {
|
||||||
|
if (format === 'csv') {
|
||||||
|
csvExport()
|
||||||
|
} else if (format === 'json') {
|
||||||
|
jsonExport()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
it('has an Export CSV button', () => {
|
it('has an Export CSV button', () => {
|
||||||
const onExport = sinon.spy()
|
|
||||||
const wrapper = shallow(<ImportDialogBox onExport={onExport} />)
|
const wrapper = shallow(<ImportDialogBox onExport={onExport} />)
|
||||||
const button = wrapper.find('.export-csv')
|
const button = wrapper.find('.export-csv')
|
||||||
expect(button).to.exist
|
expect(button).to.exist
|
||||||
//button.simulate('click')
|
button.simulate('click')
|
||||||
expect(onExport).to.have.property('callCount', 1)
|
expect(csvExport).to.have.property('callCount', 1)
|
||||||
expect(onExport.calledWith('csv')).to.equal(true)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has an Export JSON button', () => {
|
it('has an Export JSON button', () => {
|
||||||
const onExport = sinon.spy()
|
|
||||||
const wrapper = shallow(<ImportDialogBox onExport={onExport} />)
|
const wrapper = shallow(<ImportDialogBox onExport={onExport} />)
|
||||||
const button = wrapper.find('.export-json')
|
const button = wrapper.find('.export-json')
|
||||||
expect(button).to.exist
|
expect(button).to.exist
|
||||||
//button.simulate('click')
|
button.simulate('click')
|
||||||
expect(onExport).to.have.property('callCount', 1)
|
expect(jsonExport).to.have.property('callCount', 1)
|
||||||
expect(onExport.calledWith('json')).to.equal(true)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has a Download screenshot button', () => {
|
it('has a Download screenshot button', () => {
|
||||||
const onExport = sinon.spy()
|
const downloadScreenshot = sinon.spy()
|
||||||
const wrapper = shallow(<ImportDialogBox onExport={onExport} />)
|
const wrapper = shallow(<ImportDialogBox onExport={() => null} downloadScreenshot={downloadScreenshot} />)
|
||||||
const button = wrapper.find('.download-screenshot')
|
const button = wrapper.find('.download-screenshot')
|
||||||
expect(button).to.exist
|
expect(button).to.exist
|
||||||
//button.simulate('click')
|
button.simulate('click')
|
||||||
expect(onExport).to.have.property('callCount', 1)
|
expect(downloadScreenshot).to.have.property('callCount', 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has a file uploader', () => {
|
it('has a file uploader', () => {
|
||||||
const uploadedFile = {}
|
const uploadedFile = {}
|
||||||
const onFileAdded = sinon.spy()
|
const onFileAdded = sinon.spy()
|
||||||
const wrapper = shallow(<ImportDialogBox onExport={() => {}} onFileAdded={onFileAdded} />)
|
const wrapper = shallow(<ImportDialogBox onExport={() => null} onFileAdded={onFileAdded} />)
|
||||||
const dropzone = wrapper.find(Dropzone)
|
const dropzone = wrapper.find(Dropzone)
|
||||||
dropzone.props().onDropAccepted([uploadedFile], { preventDefault: () => {} })
|
dropzone.props().onDropAccepted([uploadedFile], { preventDefault: () => {} })
|
||||||
expect(onFileAdded).to.have.property('callCount', 1)
|
expect(onFileAdded).to.have.property('callCount', 1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue