diff --git a/.betterer.results b/.betterer.results index d881ab0ce7f..80e2045db11 100644 --- a/.betterer.results +++ b/.betterer.results @@ -23,9 +23,6 @@ exports[`no enzyme tests`] = { "packages/grafana-ui/src/slate-plugins/suggestions.test.tsx:2682912140": [ [0, 18, 13, "RegExp match", "2409514259"] ], - "packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.test.js:2931161174": [ - [14, 19, 13, "RegExp match", "2409514259"] - ], "packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/ViewingLayer.test.js:1676554632": [ [14, 19, 13, "RegExp match", "2409514259"] ], diff --git a/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.test.js b/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.test.js index 595b5da7586..31b8d3dd0bd 100644 --- a/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.test.js +++ b/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.test.js @@ -11,8 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - -import { shallow } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; import TickLabels from './TickLabels'; @@ -23,37 +22,36 @@ describe('', () => { duration: 5000, }; - let wrapper; let ticks; beforeEach(() => { - wrapper = shallow(); - ticks = wrapper.find('[data-test="tick"]'); + render(); + ticks = screen.getAllByTestId('tick'); }); it('renders the right number of ticks', () => { - expect(ticks.length).toBe(defaultProps.numTicks + 1); + expect(ticks).toHaveLength(defaultProps.numTicks + 1); }); it('places the first tick on the left', () => { - const firstTick = ticks.first(); - expect(firstTick.prop('style')).toEqual({ left: '0%' }); + const firstTick = ticks[0]; + expect(firstTick).toHaveStyle(`left: 0%;`); }); it('places the last tick on the right', () => { - const lastTick = ticks.last(); - expect(lastTick.prop('style')).toEqual({ right: '0%' }); + const lastTick = ticks[ticks.length - 1]; + expect(lastTick).toHaveStyle(`right: 0%;`); }); it('places middle ticks at proper intervals', () => { const positions = ['25%', '50%', '75%']; positions.forEach((pos, i) => { const tick = ticks.at(i + 1); - expect(tick.prop('style')).toEqual({ left: pos }); + expect(tick).toHaveStyle(`left: ${pos};`); }); }); it("doesn't explode if no trace is present", () => { - expect(() => shallow()).not.toThrow(); + expect(() => render()).not.toThrow(); }); }); diff --git a/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.tsx b/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.tsx index 6a81881a257..132efa0f9a1 100644 --- a/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.tsx +++ b/packages/jaeger-ui-components/src/TracePageHeader/SpanGraph/TickLabels.tsx @@ -50,7 +50,7 @@ export default function TickLabels(props: TickLabelsProps) { const portion = i / numTicks; const style = portion === 1 ? { right: '0%' } : { left: `${portion * 100}%` }; ticks.push( -
+
{formatDuration(duration * portion)}
);