mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Convert CanvasSpanGraph test to RTL (#51180)
This commit is contained in:
@@ -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"]
|
||||
],
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user