From 51242baf5939629b757eb428e22cc78417f6b283 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 30 Aug 2023 14:16:43 +0200 Subject: [PATCH] SONAR-20254 Migrate FormattingHelp test to RTL --- .../__tests__/FormattingHelp-test.tsx | 7 +- .../FormattingHelp-test.tsx.snap | 226 ------------------ 2 files changed, 5 insertions(+), 228 deletions(-) delete mode 100644 server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/FormattingHelp-test.tsx.snap diff --git a/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx index 2c28f225e8e..95adf4c234f 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/FormattingHelp-test.tsx @@ -17,10 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { shallow } from 'enzyme'; import * as React from 'react'; +import { renderComponent } from '../../../helpers/testReactTestingUtils'; +import { byRole } from '../../../helpers/testSelector'; import FormattingHelp from '../FormattingHelp'; it('should render correctly', () => { - expect(shallow()).toMatchSnapshot(); + renderComponent(); + + expect(byRole('row').getAll()).toHaveLength(10); }); diff --git a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/FormattingHelp-test.tsx.snap b/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/FormattingHelp-test.tsx.snap deleted file mode 100644 index 723d6dc652c..00000000000 --- a/server/sonar-web/src/main/js/app/components/__tests__/__snapshots__/FormattingHelp-test.tsx.snap +++ /dev/null @@ -1,226 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = ` -
- -

- Formatting Syntax -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Write: - - To display: -
- *this text is bold* - - - this text is bold - -
- https://sonarqube.org - - - https://sonarqube.org - -
- [SonarQube™ Home Page](https://www.sonarqube.org) - - - SonarQube™ Home Page - -
- * first item -
- * second item -
-
    -
  • - first item -
  • -
  • - second item -
  • -
-
- 1. first item -
- 1. second item -
-
    -
  1. - first item -
  2. -
  3. - second item -
  4. -
-
- = Heading Level 1 -
- == Heading Level 2 -
- === Heading Level 3 -
- ==== Heading Level 4 -
- ===== Heading Level 5 -
- ====== Heading Level 6 -
-
-

- Heading Level 1 -

-

- Heading Level 2 -

-

- Heading Level 3 -

-

- Heading Level 4 -

-
- Heading Level 5 -
-
- Heading Level 6 -
-
- \`\`Lists#newArrayList()\`\` - - - Lists#newArrayList() - -
- \`\` -
- // code on multiple lines -
- public void foo() { -
-    - // do some logic here -
- } -
- \`\` -
-
-            // code on multiple lines
-public void foo() {
-  // do some logic here
-}
-          
-
- Standard text -
- > Blockquoted text -
- > that spans multiple lines -
-
-

- Standard text -

-
- Blockquoted text -
- that spans multiple lines -
-
-
-
-`; -- 2.39.5