diff --git a/.betterer.results b/.betterer.results index d915d1eeae9..eb57573c522 100644 --- a/.betterer.results +++ b/.betterer.results @@ -92,9 +92,6 @@ exports[`no enzyme tests`] = { "packages/jaeger-ui-components/src/TraceTimelineViewer/index.test.js:276996587": [ [14, 19, 13, "RegExp match", "2409514259"] ], - "public/app/core/components/PageActionBar/PageActionBar.test.tsx:1251504193": [ - [0, 19, 13, "RegExp match", "2409514259"] - ], "public/app/core/components/QueryOperationRow/QueryOperationAction.test.tsx:3032694716": [ [0, 19, 13, "RegExp match", "2409514259"] ], diff --git a/public/app/core/components/PageActionBar/PageActionBar.test.tsx b/public/app/core/components/PageActionBar/PageActionBar.test.tsx index 9e68addc3a2..8f27bcb8de9 100644 --- a/public/app/core/components/PageActionBar/PageActionBar.test.tsx +++ b/public/app/core/components/PageActionBar/PageActionBar.test.tsx @@ -1,4 +1,4 @@ -import { shallow } from 'enzyme'; +import { render, screen } from '@testing-library/react'; import React from 'react'; import PageActionBar, { Props } from './PageActionBar'; @@ -13,13 +13,20 @@ const setup = (propOverrides?: object) => { Object.assign(props, propOverrides); - return shallow(); + return render(); }; describe('Render', () => { it('should render component', () => { - const wrapper = setup(); + setup(); - expect(wrapper).toMatchSnapshot(); + expect(screen.getByRole('textbox')).toBeInTheDocument(); + expect(screen.getByRole('link', { name: 'test' })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Clear' })).not.toBeInTheDocument(); + }); + it('should render button when text is present', () => { + setup({ searchQuery: 'test query' }); + + expect(screen.getByRole('button', { name: 'Clear' })).toBeInTheDocument(); }); }); diff --git a/public/app/core/components/PageActionBar/__snapshots__/PageActionBar.test.tsx.snap b/public/app/core/components/PageActionBar/__snapshots__/PageActionBar.test.tsx.snap deleted file mode 100644 index 28597c2e212..00000000000 --- a/public/app/core/components/PageActionBar/__snapshots__/PageActionBar.test.tsx.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Render should render component 1`] = ` -
-
- -
- - test - -
-`;