diff --git a/src/client/rsg-components/Editor/Editor.spec.tsx b/src/client/rsg-components/Editor/Editor.spec.tsx index 4ce518e7d..3f1c012de 100644 --- a/src/client/rsg-components/Editor/Editor.spec.tsx +++ b/src/client/rsg-components/Editor/Editor.spec.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { fireEvent, render } from '@testing-library/react'; import { shallow, mount } from 'enzyme'; import { Editor } from './Editor'; @@ -9,7 +10,6 @@ const props = { onChange() {}, code, }; - describe('Editor', () => { it('should renderer and editor', () => { const actual = shallow(); @@ -27,16 +27,10 @@ describe('Editor', () => { it('should call onChange when textarea value changes', () => { const onChange = jest.fn(); - const actual = mount(); - - expect(actual.text()).toMatch(code); + const { getByText } = render(); - // Set new value - actual.find('textarea').simulate('change', { - target: { - value: newCode, - }, - }); + const textarea = getByText(code); + fireEvent.change(textarea, { target: { value: newCode } }); expect(onChange).toBeCalledWith(newCode); });