Skip to content

Commit

Permalink
Remove password from test strings stored in localStorage (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Sep 25, 2020
1 parent 344d7a4 commit eeb8019
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
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

0 comments on commit eeb8019

Please sign in to comment.