convert bargauge test to RTL (#49701)

pull/49848/head
Ashley Harrison 3 years ago committed by GitHub
parent c8094b33cd
commit 43249464bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .betterer.results
  2. 17
      packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx
  3. 81
      packages/grafana-ui/src/components/BarGauge/__snapshots__/BarGauge.test.tsx.snap

@ -5,9 +5,6 @@
//
exports[`no enzyme tests`] = {
value: `{
"packages/grafana-ui/src/components/BarGauge/BarGauge.test.tsx:4199795290": [
[0, 19, 13, "RegExp match", "2409514259"]
],
"packages/grafana-ui/src/components/Forms/Legacy/Input/Input.test.tsx:3129955645": [
[0, 19, 13, "RegExp match", "2409514259"]
],

@ -1,4 +1,4 @@
import { shallow } from 'enzyme';
import { render } from '@testing-library/react';
import React from 'react';
import {
@ -62,17 +62,6 @@ function getProps(propOverrides?: Partial<Props>): Props {
return props;
}
const setup = (propOverrides?: object) => {
const props = getProps(propOverrides);
const wrapper = shallow(<BarGauge {...props} />);
const instance = wrapper.instance() as BarGauge;
return {
instance,
wrapper,
};
};
function getValue(value: number, title?: string): DisplayValue {
return { numeric: value, text: value.toString(), title: title };
}
@ -315,8 +304,8 @@ describe('BarGauge', () => {
describe('Render with basic options', () => {
it('should render', () => {
const { wrapper } = setup();
expect(wrapper).toMatchSnapshot();
const props = getProps();
expect(() => render(<BarGauge {...props} />)).not.toThrow();
});
});

@ -1,81 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`BarGauge Render with basic options should render 1`] = `
<div
style={
Object {
"display": "flex",
"flexDirection": "column",
"overflow": "hidden",
"width": "100%",
}
}
>
<div
style={
Object {
"alignItems": "stretch",
"display": "flex",
"flexDirection": "row-reverse",
"flexGrow": 1,
"justifyContent": "flex-end",
}
}
>
<FormattedDisplayValue
data-testid="data-testid Bar gauge value"
style={
Object {
"alignItems": "center",
"color": "#73BF69",
"display": "flex",
"fontSize": 140,
"height": "300px",
"justifyContent": "flex-end",
"lineHeight": 1,
"paddingLeft": "10px",
"paddingRight": "10px",
"width": "60px",
}
}
value={
Object {
"color": "#73BF69",
"numeric": 25,
"percent": 0.25,
"prefix": undefined,
"suffix": undefined,
"text": "25",
}
}
/>
<div
style={
Object {
"background": "rgba(255,255,255, 0.07)",
"borderRadius": "3px",
"display": "flex",
"flexGrow": 1,
"height": "300px",
"left": "-3px",
"position": "relative",
}
}
/>
<div
style={
Object {
"background": "rgba(115, 191, 105, 0.35)",
"borderRadius": "3px",
"borderRight": "2px solid #73BF69",
"height": "300px",
"position": "relative",
"transition": "width 1s",
"width": "60px",
"zIndex": 1,
}
}
/>
</div>
</div>
`;
Loading…
Cancel
Save