UNPKG

@cbinsights/react-d3-graph

Version:

React component to build interactive and configurable graphs with d3 effortlessly

33 lines (26 loc) 782 B
import React from 'react'; import renderer from 'react-test-renderer'; import Link from '../../../src/components/link/Link'; describe('Link Component', () => { let that = {}; beforeEach(() => { that.callbackMock = jest.fn(); that.link = renderer.create( <Link x1="2" y1="2" x2="4" y2="4" opacity="1" stroke="red" strokeWidth="2" onClickLink={that.callbackMock} /> ); that.tree = that.link.toJSON(); }); test('should call callback function when onClick is performed', () => { // that.tree.props.onClick(); // expect(that.callbackMock).toBeCalled(); }); });