Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to get lgtm to stop complaining about sensitive info in localStorage #730

Merged
merged 2 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/backend/tests/localStorage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const mockBlacklist: Hash<boolean> = { mockKey: true };
const mockProjectId: string = "mockProjId";
const mockUserId: string = "mockUserId";
const mockUser: User = {
...new User("mockName", "mockUsername", "mockPassword"),
...new User("mockName", "mockUsername", "mockPass"),
id: mockUserId,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/tests/LoginActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as LoginReducer from "../LoginReducer";
const createMockStore = configureMockStore([thunk]);

const user = {
...new User("testName", "testUsername", "testPassword"),
...new User("testName", "testUsername", "testPass"),
token: "testToken",
email: "test@e.mail",
};
Expand Down
24 changes: 10 additions & 14 deletions src/goals/DefaultGoal/BaseGoalScreen/tests/BaseGoalScreen.test.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from "react";
import ReactDOM from "react-dom";
import { User } from "../../../../types/user";
import { Goal } from "../../../../types/goals";
import BaseGoalScreen from "../BaseGoalScreen";
import { MergeDups } from "../../../MergeDupGoal/MergeDups";
import { Provider } from "react-redux";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";

import { Goal } from "../../../../types/goals";
import { User } from "../../../../types/user";
import { MergeDups } from "../../../MergeDupGoal/MergeDups";
import { ValidateChars } from "../../../ValidateChars/ValidateChars";
import BaseGoalScreen from "../BaseGoalScreen";

const createMockStore = configureMockStore([thunk]);

const mockStoreState = {
mergeDuplicateGoal: {
mergeTreeState: {
Expand All @@ -33,14 +33,13 @@ const mockStoreState = {
},
},
};
const mockUser: User = new User("TestUser", "TestUsername", "TestPass");

it("renders without crashing", () => {
const mockStore = createMockStore(mockStoreState);

const div = document.createElement("div");
let user: User = new User("TestUser", "TestUsername", "password");
let goal: Goal = new MergeDups();
goal.user = user;
const goal: Goal = new MergeDups();
goal.user = mockUser;
ReactDOM.render(
<Provider store={mockStore}>
<BaseGoalScreen goal={goal} />
Expand All @@ -52,11 +51,9 @@ it("renders without crashing", () => {

it("renders without crashing when given goal with non-existent steps", () => {
const mockStore = createMockStore(mockStoreState);

const div = document.createElement("div");
let user: User = new User("TestUser", "TestUsername", "password");
let goal: Goal = new ValidateChars();
goal.user = user;
const goal: Goal = new ValidateChars();
goal.user = mockUser;
ReactDOM.render(
<Provider store={mockStore}>
<BaseGoalScreen goal={goal} />
Expand All @@ -68,7 +65,6 @@ it("renders without crashing when given goal with non-existent steps", () => {

it("renders without crashing when given undefined goal", () => {
const mockStore = createMockStore(mockStoreState);

const div = document.createElement("div");
ReactDOM.render(
<Provider store={mockStore}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from "react";
import ReactDOM from "react-dom";

import { User } from "../../../../types/user";
import { Goal } from "../../../../types/goals";
import BaseGoalWidget from "../BaseGoalWidget";
import { CreateCharInv } from "../../../CreateCharInv/CreateCharInv";
import BaseGoalWidget from "../BaseGoalWidget";

it("renders without crashing", () => {
const div = document.createElement("div");
let user: User = new User("TestUser", "TestUsername", "password");
let goal: Goal = new CreateCharInv();
const user: User = new User("TestUser", "TestUsername", "TestPass");
const goal: Goal = new CreateCharInv();
goal.user = user;
ReactDOM.render(<BaseGoalWidget goal={goal} />, div);
ReactDOM.unmountComponentAtNode(div);
Expand Down