diff --git a/.betterer.results b/.betterer.results index cf4faad28b6..79be33b67cf 100644 --- a/.betterer.results +++ b/.betterer.results @@ -98,9 +98,6 @@ exports[`no enzyme tests`] = { "packages/jaeger-ui-components/src/TraceTimelineViewer/index.test.js:381298544": [ [14, 19, 13, "RegExp match", "2409514259"] ], - "packages/jaeger-ui-components/src/common/UiFindInput.test.js:2207118020": [ - [14, 19, 13, "RegExp match", "2409514259"] - ], "packages/jaeger-ui-components/src/url/ReferenceLink.test.js:3249503373": [ [14, 26, 13, "RegExp match", "2409514259"] ], diff --git a/packages/jaeger-ui-components/src/common/UiFindInput.test.js b/packages/jaeger-ui-components/src/common/UiFindInput.test.js index e918af42cb8..43f3fad8869 100644 --- a/packages/jaeger-ui-components/src/common/UiFindInput.test.js +++ b/packages/jaeger-ui-components/src/common/UiFindInput.test.js @@ -12,58 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { shallow } from 'enzyme'; -// eslint-disable-next-line lodash/import-scope -import _ from 'lodash'; +import { render, screen } from '@testing-library/react'; import * as React from 'react'; -import { Input } from '@grafana/ui'; - import UiFindInput from './UiFindInput'; -const debounceMock = jest.spyOn(_, 'debounce').mockImplementation((func) => { - return Object.assign(func, { cancel: jest.fn(), flush: jest.fn() }); -}); - describe('UiFindInput', () => { - const flushMock = jest.fn(); - - const uiFind = 'uiFind'; - const ownInputValue = 'ownInputValue'; - const props = { - uiFind: undefined, - history: { - replace: () => {}, - }, - location: { - search: null, - }, - }; - let wrapper; - - beforeAll(() => { - debounceMock.mockImplementation((fn) => { - function debounceFunction(...args) { - fn(...args); - } - debounceFunction.flush = flushMock; - return debounceFunction; - }); - }); - - beforeEach(() => { - flushMock.mockReset(); - wrapper = shallow(); - }); - describe('rendering', () => { - it('renders as expected', () => { - expect(wrapper).toMatchSnapshot(); + it('renders as expected with no value', () => { + render(); + const uiFindInput = screen.queryByPlaceholderText('Find...'); + expect(uiFindInput).toBeInTheDocument(); + expect(uiFindInput['value']).toEqual(''); }); - it('renders props.uiFind when state.ownInputValue is `undefined`', () => { - wrapper.setProps({ value: uiFind }); - expect(wrapper.find(Input).prop('value')).toBe(uiFind); + it('renders as expected with value', () => { + render(); + const uiFindInput = screen.queryByPlaceholderText('Find...'); + expect(uiFindInput).toBeInTheDocument(); + expect(uiFindInput['value']).toEqual('value'); }); }); }); diff --git a/packages/jaeger-ui-components/src/common/__snapshots__/UiFindInput.test.js.snap b/packages/jaeger-ui-components/src/common/__snapshots__/UiFindInput.test.js.snap deleted file mode 100644 index 9d6e29d5697..00000000000 --- a/packages/jaeger-ui-components/src/common/__snapshots__/UiFindInput.test.js.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UiFindInput rendering renders as expected 1`] = ` -} -/> -`;