From 20b451afb6e9d3229165ac8d24d28e74ff9891e3 Mon Sep 17 00:00:00 2001
From: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com>
Date: Fri, 19 Aug 2022 17:25:48 +0500
Subject: [PATCH] refactor: reverted changes made to satisfy
jsx-no-useless-fragment rule
---
src/account-settings/EditableField.jsx | 3 ++-
.../delete-account/DeleteAccount.test.jsx | 5 +++--
.../tests/IdVerificationPage.test.jsx | 19 ++++++++++---------
.../VerifiedNameContextProvider.test.jsx | 5 ++++-
.../panels/TakePortraitPhotoPanel.test.jsx | 3 ++-
5 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/account-settings/EditableField.jsx b/src/account-settings/EditableField.jsx
index fcb2181..aeaa750 100644
--- a/src/account-settings/EditableField.jsx
+++ b/src/account-settings/EditableField.jsx
@@ -1,3 +1,4 @@
+/* eslint-disable react/jsx-no-useless-fragment */
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
@@ -128,7 +129,7 @@ function EditableField(props) {
options={inputOptions}
{...others}
/>
- {others.children}
+ <>{others.children}>
function () {
- return null;
+ return <>>;
});
jest.mock('./SuccessModal', () => function () {
- return null;
+ return <>>;
});
import { DeleteAccount } from './DeleteAccount'; // eslint-disable-line import/first
diff --git a/src/id-verification/tests/IdVerificationPage.test.jsx b/src/id-verification/tests/IdVerificationPage.test.jsx
index 8c6d401..4f6e2fc 100644
--- a/src/id-verification/tests/IdVerificationPage.test.jsx
+++ b/src/id-verification/tests/IdVerificationPage.test.jsx
@@ -1,3 +1,4 @@
+/* eslint-disable react/jsx-no-useless-fragment */
import React from 'react';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
@@ -19,31 +20,31 @@ jest.mock('../VerifiedNameContext', () => {
};
});
jest.mock('../panels/ReviewRequirementsPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/RequestCameraAccessPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/PortraitPhotoContextPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/TakePortraitPhotoPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/IdContextPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/GetNameIdPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/TakeIdPhotoPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/SummaryPanel', () => function () {
- return null;
+ return <>>;
});
jest.mock('../panels/SubmittedPanel', () => function () {
- return null;
+ return <>>;
});
const IntlIdVerificationPage = injectIntl(IdVerificationPage);
diff --git a/src/id-verification/tests/VerifiedNameContextProvider.test.jsx b/src/id-verification/tests/VerifiedNameContextProvider.test.jsx
index 1452c76..96d1e68 100644
--- a/src/id-verification/tests/VerifiedNameContextProvider.test.jsx
+++ b/src/id-verification/tests/VerifiedNameContextProvider.test.jsx
@@ -1,3 +1,4 @@
+/* eslint-disable react/jsx-no-useless-fragment */
import React, { useContext } from 'react';
import { render, cleanup, waitFor } from '@testing-library/react';
@@ -7,7 +8,9 @@ import { VerifiedNameContext, VerifiedNameContextProvider } from '../VerifiedNam
function VerifiedNameContextTestComponent() {
const { verifiedName } = useContext(VerifiedNameContext);
return (
- verifiedName && ({verifiedName}
)
+ <>
+ {verifiedName && ({verifiedName}
)}
+ >
);
}
diff --git a/src/id-verification/tests/panels/TakePortraitPhotoPanel.test.jsx b/src/id-verification/tests/panels/TakePortraitPhotoPanel.test.jsx
index 2dfa34f..a0f4313 100644
--- a/src/id-verification/tests/panels/TakePortraitPhotoPanel.test.jsx
+++ b/src/id-verification/tests/panels/TakePortraitPhotoPanel.test.jsx
@@ -1,3 +1,4 @@
+/* eslint-disable react/jsx-no-useless-fragment */
import React from 'react';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
@@ -13,7 +14,7 @@ jest.mock('@edx/frontend-platform/analytics', () => ({
}));
jest.mock('../../Camera', () => function () {
- return null;
+ return <>>;
});
const history = createMemoryHistory();