diff --git a/frontend/test/components/MapView/ImportDialogBox.spec.js b/frontend/test/components/MapView/ImportDialogBox.spec.js
index ad42b5b1..5059d375 100644
--- a/frontend/test/components/MapView/ImportDialogBox.spec.js
+++ b/frontend/test/components/MapView/ImportDialogBox.spec.js
@@ -7,39 +7,45 @@ import { shallow } from 'enzyme'
import sinon from 'sinon'
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', () => {
- const onExport = sinon.spy()
const wrapper = shallow()
const button = wrapper.find('.export-csv')
expect(button).to.exist
- //button.simulate('click')
- expect(onExport).to.have.property('callCount', 1)
- expect(onExport.calledWith('csv')).to.equal(true)
+ button.simulate('click')
+ expect(csvExport).to.have.property('callCount', 1)
})
it('has an Export JSON button', () => {
- const onExport = sinon.spy()
const wrapper = shallow()
const button = wrapper.find('.export-json')
expect(button).to.exist
- //button.simulate('click')
- expect(onExport).to.have.property('callCount', 1)
- expect(onExport.calledWith('json')).to.equal(true)
+ button.simulate('click')
+ expect(jsonExport).to.have.property('callCount', 1)
})
it('has a Download screenshot button', () => {
- const onExport = sinon.spy()
- const wrapper = shallow()
+ const downloadScreenshot = sinon.spy()
+ const wrapper = shallow( null} downloadScreenshot={downloadScreenshot} />)
const button = wrapper.find('.download-screenshot')
expect(button).to.exist
- //button.simulate('click')
- expect(onExport).to.have.property('callCount', 1)
+ button.simulate('click')
+ expect(downloadScreenshot).to.have.property('callCount', 1)
})
it('has a file uploader', () => {
const uploadedFile = {}
const onFileAdded = sinon.spy()
- const wrapper = shallow( {}} onFileAdded={onFileAdded} />)
+ const wrapper = shallow( null} onFileAdded={onFileAdded} />)
const dropzone = wrapper.find(Dropzone)
dropzone.props().onDropAccepted([uploadedFile], { preventDefault: () => {} })
expect(onFileAdded).to.have.property('callCount', 1)