From d774deab992c36dded7ca8d3d265859c962a3fad Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Tue, 3 May 2022 08:45:50 +0100 Subject: [PATCH] convert test to RTL (#48291) --- .betterer.results | 3 --- .../src/components/Typeahead/TypeaheadInfo.test.tsx | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.betterer.results b/.betterer.results index 62c6da52a9f..40a253a0e39 100644 --- a/.betterer.results +++ b/.betterer.results @@ -50,9 +50,6 @@ exports[`no enzyme tests`] = { "packages/grafana-ui/src/components/Typeahead/Typeahead.test.tsx:972524250": [ [0, 17, 13, "RegExp match", "2409514259"] ], - "packages/grafana-ui/src/components/Typeahead/TypeaheadInfo.test.tsx:3512289373": [ - [0, 17, 13, "RegExp match", "2409514259"] - ], "packages/grafana-ui/src/slate-plugins/braces.test.tsx:1440546721": [ [0, 19, 13, "RegExp match", "2409514259"] ], diff --git a/packages/grafana-ui/src/components/Typeahead/TypeaheadInfo.test.tsx b/packages/grafana-ui/src/components/Typeahead/TypeaheadInfo.test.tsx index 78624ee43ef..214be3e5e7e 100644 --- a/packages/grafana-ui/src/components/Typeahead/TypeaheadInfo.test.tsx +++ b/packages/grafana-ui/src/components/Typeahead/TypeaheadInfo.test.tsx @@ -1,4 +1,4 @@ -import { mount } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; import { CompletionItem } from '../../types'; @@ -6,9 +6,9 @@ import { CompletionItem } from '../../types'; import { TypeaheadInfo } from './TypeaheadInfo'; describe('TypeaheadInfo component', () => { - it('should show documentation as rendered markdown if passed as a markdown', () => { - const item: CompletionItem = { label: 'markdown', documentation: '**bold**' }; - const wrapper = mount(); - expect(wrapper.find('div>div').html()).toMatch('strong'); + it('should show documentation as rendered markdown if passed as markdown', () => { + const item: CompletionItem = { label: 'markdown', documentation: '# My heading' }; + render(); + expect(screen.getByRole('heading', { name: 'My heading' })).toBeInTheDocument(); }); });