Skip to content

Commit

Permalink
Merge pull request #21 from andela/ft-password-reset-#168049942
Browse files Browse the repository at this point in the history
#168049942 password reset
  • Loading branch information
gik-hub committed Nov 25, 2019
2 parents 85e3a7d + 8fa1b2e commit 04ec6dc
Show file tree
Hide file tree
Showing 22 changed files with 625 additions and 10 deletions.
98 changes: 98 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
"jest-enzyme": "^7.1.2",
"moxios": "^0.4.0",
"react-test-renderer": "^16.11.0",
"redux-mock-store": "^1.5.3"
"redux-mock-store": "^1.5.3",
"sinon": "^7.5.0"
}
}
5 changes: 2 additions & 3 deletions src/__tests__/components/common/close-icon-button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ const props = {
const setUp = () => shallow(<CloseIconButton {...props} />);
const findByAttr = (wrapper, dataTest) => wrapper.find(`[data-test="${dataTest}"]`);
// tests
test.only("It renders without error", () => {
test("It renders without error", () => {
const wrapper = setUp();
const closeIcon = findByAttr(wrapper, "component-close-icon");
expect(closeIcon.length).toBe(1);
expect(closeIcon.text()).toBeTruthy()
console.log(closeIcon.text());
expect(closeIcon.text()).toBeTruthy();
});
4 changes: 2 additions & 2 deletions src/__tests__/components/login-page/SocialLogins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { shallow } from "enzyme";
import { SocialLogin } from "../../../components/login-page/SocialLogins";

const props = {
location
location,
};
describe("Social Logins", () => {
const socialLogin = shallow(<SocialLogin {...props} />);
Expand All @@ -26,7 +26,7 @@ describe("Social Logins", () => {
test("should redirect to facebook callback", () => {
const spyFacebookCall = jest.spyOn(
socialLogin.instance(),
"facebookLogin"
"facebookLogin",
);
socialLogin.instance().forceUpdate();
socialLogin.find(".facebook").simulate("click", spyFacebookCall);
Expand Down
24 changes: 24 additions & 0 deletions src/__tests__/components/passwordReset/forgotEmailForm.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import { mount } from "enzyme";
import sinon from "sinon";
import { PassReset } from "../../../components/passwordReset/forgotEmailForm";

const onSubmit = sinon.spy();

const props = {
passWordResetAction: jest.fn(),
};
const setUp = () => mount(<PassReset onSubmit={onSubmit} {...props} />);
// const findByAttr = (wrapper, dataTest) => wrapper.find(`[data-test="${dataTest}"]`);

test("it renders component successfully", () => {
const wrapper = setUp();
expect(wrapper.length).toBe(1);
});

it("should check if data are valid when you send the data without typing", () => {
const wrapper = setUp();
const button = wrapper.find("button");
button.simulate("submit");
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import { shallow } from "enzyme";
import VerifyPasswordReset from "../../../components/passwordReset/passwordResetConfirmation";

const setUp = () => shallow(<VerifyPasswordReset />);
// tests
test("it renders the component successfully", () => {
const wrapper = setUp();
expect(wrapper.length).toBe(1);
});
26 changes: 26 additions & 0 deletions src/__tests__/components/passwordReset/resetPassword.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from "react";
import { mount } from "enzyme";
import sinon from "sinon";
import { PasswordChange } from "../../../components/passwordReset/resetPassword";

const onSubmit = sinon.spy();
const props = {
passWordChangeAction: jest.fn(),
match: {
params: "token",
},
};
const setUp = () => mount(<PasswordChange onSubmit={onSubmit} {...props} />);
// const findByAttr = (wrapper, dataTest) => wrapper.find(`[data-test="${dataTest}"]`);

test("it renders component successfully", () => {
const wrapper = setUp();
expect(wrapper.length).toBe(1);
});

it("should check if data are valid when you send the data without typing", () => {
const wrapper = setUp();
const button = wrapper.find("button");
button.simulate("submit");
});
Loading

0 comments on commit 04ec6dc

Please sign in to comment.