Skip to content

Commit

Permalink
Added Test for Layout Manager
Browse files Browse the repository at this point in the history
Signed-off-by: Prathamesh Mutkure <[email protected]>
  • Loading branch information
prathamesh-mutkure committed Nov 29, 2023
1 parent 56925c7 commit f9c602e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/jaeger-ui/src/components/DependencyGraph/DAG.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import { render, screen } from '@testing-library/react';
import { shallow } from 'enzyme';
import DAG, { renderNode } from './DAG';

// mock canvas API (we don't care about canvas results)
Expand Down Expand Up @@ -167,3 +168,12 @@ describe('renderNode', () => {
expect(element.textContent).toBe('');
});
});

describe('clean up', () => {
it('stops LayoutManager before unmounting', () => {
const wrapper = shallow(<DAG serviceCalls={[]} />);
const stopAndReleaseSpy = jest.spyOn(wrapper.instance().layoutManager, 'stopAndRelease');
wrapper.unmount();
expect(stopAndReleaseSpy).toHaveBeenCalledTimes(1);
});
});

0 comments on commit f9c602e

Please sign in to comment.