Remove unused imports and variables

This commit is contained in:
Nathan Barber
2021-05-17 13:37:54 -04:00
parent 7e85b2ec3e
commit 97b6b71983
16 changed files with 93 additions and 82 deletions

View File

@@ -1,9 +1,7 @@
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { compose, withProps } from "recompose";
import { Link } from "react-router-dom";
import PropTypes from "prop-types";
import { jhapiRequest } from "../../util/jhapiUtil";
const AddUser = (props) => {
var [users, setUsers] = useState([]),
@@ -84,9 +82,6 @@ const AddUser = (props) => {
/[!@#$%^&*(),.?":{}|<>]/g.test(e) == false
);
if (filtered_users.length < users.length) {
let removed_users = users.filter(
(e) => !filtered_users.includes(e)
);
setUsers(filtered_users);
failRegexEvent();
}

View File

@@ -16,7 +16,9 @@ jest.mock("react-redux", () => ({
describe("AddUser Component: ", () => {
var mockAsync = () =>
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
jest
.fn()
.mockImplementation(() => Promise.resolve({ key: "value", status: 200 }));
var addUserJsx = (callbackSpy) => (
<Provider store={createStore(() => {}, {})}>
@@ -25,7 +27,7 @@ describe("AddUser Component: ", () => {
addUsers={callbackSpy}
failRegexEvent={callbackSpy}
updateUsers={callbackSpy}
history={{ push: (a) => {} }}
history={{ push: () => {} }}
/>
</HashRouter>
</Provider>
@@ -36,7 +38,7 @@ describe("AddUser Component: ", () => {
});
beforeEach(() => {
useDispatch.mockImplementation((callback) => {
useDispatch.mockImplementation(() => {
return () => {};
});
useSelector.mockImplementation((callback) => {