Convert CanvasSpanGraph test to RTL (#51180)

This commit is contained in:
Seyaji
2022-06-22 12:46:01 +01:00
committed by GitHub
parent 7cee620fbb
commit 5ad3d10016
2 changed files with 13 additions and 14 deletions

View File

@@ -29,9 +29,6 @@ exports[`no enzyme tests`] = {
"packages/grafana-ui/src/slate-plugins/suggestions.test.tsx:3654981205": [
[0, 18, 13, "RegExp match", "2409514259"]
],
"packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/CanvasSpanGraph.test.js:1974748555": [
[14, 19, 13, "RegExp match", "2409514259"]
],
"packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/GraphTicks.test.js:940336852": [
[14, 19, 13, "RegExp match", "2409514259"]
],

View File

@@ -12,23 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { shallow } from 'enzyme';
import { render } from '@testing-library/react';
import React from 'react';
import { createTheme } from '@grafana/data';
import { UnthemedCanvasSpanGraph } from './CanvasSpanGraph';
describe('<CanvasSpanGraph>', () => {
describe('CanvasSpanGraph tests', () => {
it('renders without exploding', () => {
const items = [{ valueWidth: 1, valueOffset: 1, serviceName: 'service-name-0' }];
const wrapper = shallow(<UnthemedCanvasSpanGraph items={[]} valueWidth={4000} theme={createTheme()} />);
expect(wrapper).toBeDefined();
wrapper.instance()._setCanvasRef({
getContext: () => ({
fillRect: () => {},
}),
});
wrapper.setProps({ items });
expect(() =>
render(<UnthemedCanvasSpanGraph items={items} valueWidth={4000} theme={createTheme()} />)
).not.toThrow();
});
});
const items = [
{
valueWidth: 1,
valueOffset: 1,
serviceName: 'service-name-0',
},
];