Created
January 31, 2019 22:25
-
-
Save Ranguro/6f731edc267ffef038da654c70171494 to your computer and use it in GitHub Desktop.
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
import React from 'react'; | |
import { mount } from 'enzyme'; | |
import { Plot } from '../<InsertDirHere>'; | |
describe('Plot', () => { | |
describe('<Plot/> Component', () => { | |
const data = []; | |
const id = 'Chart_1'; | |
const layout = {}; | |
const afterDrawMock = jest.fn(); | |
const props = { id, data, layout, afterDraw: afterDrawMock }; | |
it('should call drawPlot method', () => { | |
console.log('Call sequence'); | |
const spyDrawPlot = jest.spyOn(Plot.prototype, 'drawPlot'); | |
console.log('Call after spying'); | |
const wrapper = mount(<Plot {...props}></Plot>); | |
wrapper.instance().componentDidMount(); | |
expect(spyDrawPlot).toHaveBeenCalled(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment