From bcc347d22df78624dd8118dfa034f2a6fade646a Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 28 Oct 2021 15:25:35 -0400 Subject: [PATCH 1/2] ref(tests) Convert a few simple tests to RTL Nothing complicated, just two more files complete. --- tests/js/spec/components/textCopyInput.spec.jsx | 6 +++--- tests/js/spec/components/toolbarHeader.spec.jsx | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/js/spec/components/textCopyInput.spec.jsx b/tests/js/spec/components/textCopyInput.spec.jsx index 449261433c9cb6..781e0edd719f3a 100644 --- a/tests/js/spec/components/textCopyInput.spec.jsx +++ b/tests/js/spec/components/textCopyInput.spec.jsx @@ -1,10 +1,10 @@ -import {mountWithTheme} from 'sentry-test/enzyme'; +import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary'; import TextCopyInput from 'app/views/settings/components/forms/textCopyInput'; describe('TextCopyInput', function () { it('renders', function () { - const wrapper = mountWithTheme(Text to Copy); - expect(wrapper).toSnapshot(); + mountWithTheme(Text to Copy); + expect(screen.getByDisplayValue('Text to Copy')).toBeInTheDocument(); }); }); diff --git a/tests/js/spec/components/toolbarHeader.spec.jsx b/tests/js/spec/components/toolbarHeader.spec.jsx index 52718571d431db..e62aade08598f1 100644 --- a/tests/js/spec/components/toolbarHeader.spec.jsx +++ b/tests/js/spec/components/toolbarHeader.spec.jsx @@ -1,4 +1,4 @@ -import {mountWithTheme} from 'sentry-test/enzyme'; +import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary'; import ToolbarHeader from 'app/components/toolbarHeader'; @@ -8,11 +8,12 @@ describe('ToolbarHeader', function () { afterEach(function () {}); it('renders', function () { - const wrapper = mountWithTheme( + const {container} = mountWithTheme(
Toolbar Header
); - expect(wrapper).toSnapshot(); + expect(screen.getByText('Toolbar Header')).toBeInTheDocument(); + expect(container).toSnapshot(); }); }); From 44f27051cba605fb4b6aa56256eec6368954dcb1 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 29 Oct 2021 10:19:19 -0400 Subject: [PATCH 2/2] Re-add snapshot. --- tests/js/spec/components/textCopyInput.spec.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/js/spec/components/textCopyInput.spec.jsx b/tests/js/spec/components/textCopyInput.spec.jsx index 781e0edd719f3a..14617e12d56ced 100644 --- a/tests/js/spec/components/textCopyInput.spec.jsx +++ b/tests/js/spec/components/textCopyInput.spec.jsx @@ -4,7 +4,8 @@ import TextCopyInput from 'app/views/settings/components/forms/textCopyInput'; describe('TextCopyInput', function () { it('renders', function () { - mountWithTheme(Text to Copy); + const {container} = mountWithTheme(Text to Copy); + expect(container).toSnapshot(); expect(screen.getByDisplayValue('Text to Copy')).toBeInTheDocument(); }); });