Skip to content

Commit

Permalink
Merge 6f7763d into 04ec6dc
Browse files Browse the repository at this point in the history
  • Loading branch information
amilykassim committed Nov 26, 2019
2 parents 04ec6dc + 6f7763d commit ab0ef3a
Show file tree
Hide file tree
Showing 70 changed files with 5,394 additions and 243 deletions.
390 changes: 251 additions & 139 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
"redux-devtools-extension": "^2.13.8",
"redux-mock-store": "^1.5.3",
"redux-thunk": "^2.3.0",
"socket.io-client": "^2.3.0"
"socket.io-client": "^2.3.0",
"draft-js": "^0.11.0",
"draftjs-to-html": "^0.8.4",
"react-draft-wysiwyg": "^1.13.2"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -76,6 +79,7 @@
]
},
"devDependencies": {
"axios-mock-adapter": "^1.17.0",
"coveralls": "^3.0.7",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
Expand Down
5 changes: 5 additions & 0 deletions src/__tests__/components/login-page/LoginForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ describe("Login Form", () => {
expect(loginForm.find(".title").text()).toEqual("Login");
});

it("should test for login a user", () => {
const button = loginForm.find("button[className=\"button\"]");
button.simulate("click");
});

test("should render the login button", () => {
expect(loginForm.find(".button").text()).toEqual("Login");
});
Expand Down
28 changes: 17 additions & 11 deletions src/__tests__/components/register-page/registerPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
/* eslint-disable no-undef */
import React from "react";
import { mount } from "enzyme";
import { Register } from '../../../components/register-page/RegisterPage';
import { Register, mapStateToProps as mapStateToPropsNew } from '../../../components/register-page/RegisterPage';

describe("<RegisterPage />", () => {
const wrapper = mount(<Register />);
// console.log(wrapper.debug());

it("should taste the errors functionality", () => {
const event = { target: { name: 'firstname', value: 'am' } };
Expand All @@ -18,15 +19,14 @@ describe("<RegisterPage />", () => {
});

it("should check if data are valid when you send the data without typing", () => {
const form = wrapper.find('form[className="card"]');
form.simulate('submit');
wrapper.find('button[className="button"]');
});

it("should check if password and confirm password are the same", () => {
const values = [
{ target: { name: 'firstname', value: 'test' } },
{ target: { name: 'lastname', value: 'test' } },
{ target: { name: 'username', value: 'test' } },
{ target: { name: 'username', value: 1 } },
{ target: { name: 'email', value: 'test@gmail.com' } },
{ target: { name: 'password', value: 'test1#' } },
{ target: { name: 'confirmPassword', value: 'test1@' } }];
Expand All @@ -36,11 +36,13 @@ describe("<RegisterPage />", () => {
input.simulate('change', value);
});

const form = wrapper.find('form[className="card"]');
form.simulate('submit');
// const form = wrapper.find('form[className="card"]');
const button = wrapper.find('button[className="button"]');

const { data } = wrapper.state();
expect(data[values[0].target.name]).toEqual(values[0].target.value);
button.simulate('click');

// const { data } = wrapper.state();
// expect(data[values[0].target.name]).toEqual(values[0].target.value);
});

it("should check if the input field are being rendered", () => {
Expand All @@ -62,8 +64,12 @@ describe("<RegisterPage />", () => {
expect(data[values[0].target.name]).toEqual(values[0].target.value);
});

it("should simulate the submit button", () => {
const form = wrapper.find('form[className="card"]');
form.simulate('submit');
it("should test for register a user", () => {
const button = wrapper.find('button[className="button"]');
button.simulate('click');
});

it("should test map state to props of register", () => {
mapStateToPropsNew({ register: {} });
});
});
Loading

0 comments on commit ab0ef3a

Please sign in to comment.