From 94c431afb0954693030d33f9d2738f5149c3c090 Mon Sep 17 00:00:00 2001 From: Viviane Dias <9057801+vivianedias@users.noreply.github.com> Date: Thu, 26 May 2022 08:59:06 -0300 Subject: [PATCH] [single-article] Refactor class components to be functional component (#17681) * refactor(single-article): migrates class to use pure components * test(single-article): removes repeated test from file --- .../__tests__/singleArticle.test.jsx | 39 ++---- .../modCenter/singleArticle/index.jsx | 130 ++++++++---------- 2 files changed, 74 insertions(+), 95 deletions(-) diff --git a/app/javascript/modCenter/singleArticle/__tests__/singleArticle.test.jsx b/app/javascript/modCenter/singleArticle/__tests__/singleArticle.test.jsx index 91055d516..b698a544f 100644 --- a/app/javascript/modCenter/singleArticle/__tests__/singleArticle.test.jsx +++ b/app/javascript/modCenter/singleArticle/__tests__/singleArticle.test.jsx @@ -1,8 +1,8 @@ -/* eslint-disable jest/expect-expect */ import { h, Fragment } from 'preact'; import { axe } from 'jest-axe'; import { render, getNodeText, waitFor } from '@testing-library/preact'; import { SingleArticle } from '../index'; +import '@testing-library/jest-dom'; const getTestArticle = () => ({ id: 1, @@ -39,9 +39,10 @@ describe('', () => { }); it('renders the article title', () => { - const { queryByText } = render( + const articleProps = getTestArticle(); + const { getByRole } = render( - +