Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
beejay1293 committed Jul 15, 2019
1 parent 1084833 commit bc788b3
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 132 deletions.
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module.exports = {
'!jest.config.js',
'!<rootDir>/server.js',
'!webpack.common.js',
'!**/*.scss',
'!webpack.dev.js',
'!webpack.prod.js',
'!**/src/App.jsx',
Expand Down
16 changes: 0 additions & 16 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
},
"homepage": "https://github.com/andela/freyja-ah-frontend#readme",
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@babel/runtime": "^7.5.4",
"@fortawesome/fontawesome-svg-core": "^1.2.19",
"@fortawesome/free-brands-svg-icons": "^5.9.0",
"@fortawesome/free-solid-svg-icons": "^5.9.0",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Heading/heading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ $color: #212529;
margin-bottom: 3%;
margin-top: 2%;
text-align: center;
}
}
7 changes: 4 additions & 3 deletions src/components/ResetPassword/ResetPassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CardText, CardBody, CardSubtitle, FormGroup,
} from 'reactstrap';
import { connect } from 'react-redux';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import propTypes from 'prop-types';
import './resetpassword.scss';
import * as actions from '../../../store/actions/authActions/resetPassword';
Expand All @@ -12,6 +13,7 @@ import Input from '../Inputs/Input';
import Footer from '../Footer/Footer';
import { Header } from '../Header/Header';
import { Heading } from '../Heading/Heading';

/**
* @description
* @param
Expand All @@ -34,8 +36,7 @@ export class ResetPasswordCard extends Component {
}

handleSubmit() {
const { ResetPassword } = this.props;
const { history } = this.props;
const { ResetPassword, history } = this.props;
const { email } = this.state;
ResetPassword(email, history);
}
Expand All @@ -49,7 +50,7 @@ export class ResetPasswordCard extends Component {
<Card>
<CardBody>
<CardSubtitle>
<i className="fas fa-lock" />
<FontAwesomeIcon icon="lock" />
</CardSubtitle>
<Heading title="Forgot Password?" />
<CardText>
Expand Down
8 changes: 1 addition & 7 deletions src/components/ResetPassword/resetpassword.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ $success-color: #008000;
.card-subtitle {
margin-bottom: 20px;
text-align: center;

.fa-lock {
font-size: 50px;
}
}

.card-text {
Expand All @@ -67,8 +63,7 @@ $success-color: #008000;
font-size: 20px;
line-height: 20px;
margin-bottom: 20px;
text-align: center;

text-align: center;
}

.form-group {
Expand Down Expand Up @@ -117,7 +112,6 @@ $success-color: #008000;
transition: 0.2s;
width: 100%;


&:hover {
background-color: $form-color;
opacity: 0.6;
Expand Down
2 changes: 0 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

<head>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://kit.fontawesome.com/b86fe9836a.js"></script>
</head>

<body>
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import React from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux';
import { library } from '@fortawesome/fontawesome-svg-core';
import '@babel/polyfill';
import 'bootstrap/dist/css/bootstrap.min.css';
import { faUserFriends, faCertificate, faPeopleCarry } from '@fortawesome/free-solid-svg-icons';
import { faUserFriends, faCertificate, faPeopleCarry, faLock } from '@fortawesome/free-solid-svg-icons';
import { fab } from '@fortawesome/free-brands-svg-icons';
import { BrowserRouter } from 'react-router-dom';
import Routes from './routes/routes';
import store from '../store';

import './style.css';

library.add(faUserFriends, faCertificate, faPeopleCarry);
library.add(faUserFriends, faCertificate, faPeopleCarry, faLock);

library.add(fab);

Expand Down
99 changes: 47 additions & 52 deletions src/test/actions/authActions/resetPassword.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,54 @@ import { ResetPasswordCard } from '../../../components/ResetPassword/ResetPasswo


describe('Test methods', () => {
beforeEach(() => {
sinon.spy(ResetPasswordCard.prototype, 'handleSubmit');
sinon.spy(ResetPasswordCard.prototype, 'handleEmail');
sinon.spy(ResetPasswordCard.prototype, 'handleSubmit');
sinon.spy(ResetPasswordCard.prototype, 'handleEmail');


function shallowSetup() {
const props = {
ResetPassword: () => {},
loading: true,
passwordResetSuccess: 'please check you email',
passwordResetError: 'invalid email',
};

const enzymeWrapper = shallow(<ResetPasswordCard {...props} />);

return {
props,
enzymeWrapper,
};
}

describe('Shallow rendered Reset password Card', () => {
it('should render a card with the details of the Reset password page', () => {
const { enzymeWrapper } = shallowSetup();
expect(enzymeWrapper.find('.error').text()).toBe('invalid email');
expect(enzymeWrapper.find('.success').text()).toBe('please check you email');
expect(enzymeWrapper.find('Button').text()).toBe('<Button />');
expect(enzymeWrapper.find('CardText').first().text()).toBe('<CardText />');
});
});
it('should tes', () => {
expect(2).toBe(2);
});
});

function shallowSetup() {
const props = {
ResetPassword: () => {},
loading: true,
passwordResetSuccess: 'please check you email',
passwordResetError: 'invalid email',
};

const enzymeWrapper = shallow(<ResetPasswordCard {...props} />);

return {
props,
enzymeWrapper,
};
}

describe('Shallow rendered Reset password Card', () => {
it('should render a card with the details of the Reset password page', () => {
const { enzymeWrapper } = shallowSetup();
expect(enzymeWrapper.find('.error').text()).toBe('invalid email');
expect(enzymeWrapper.find('.success').text()).toBe('please check you email');
expect(enzymeWrapper.find('Button').text()).toBe('<Button />');
expect(enzymeWrapper.find('i').first().text()).toBe('');
expect(enzymeWrapper.find('CardText').first().text()).toBe('<CardText />');
});
});

describe('Reset Password', () => {
let wrapper;
beforeEach(() => {
const { enzymeWrapper } = shallowSetup();
wrapper = enzymeWrapper;
});
it('should update the state property _**`formOpen`**_ and call handleOpen when edit button is clicked', () => {
const button = wrapper.find('Button').first();
button.simulate('click');
expect(ResetPasswordCard.prototype.handleSubmit.calledOnce).toBe(true);
});

it('should display current values in edit fields', () => {
const input = wrapper.find('InputField');
const mockedEvent = { target: {} };
input.simulate('change', mockedEvent);

expect(ResetPasswordCard.prototype.handleEmail.calledOnce).toBe(true);
describe('Reset Password', () => {
let wrapper;
beforeEach(() => {
const { enzymeWrapper } = shallowSetup();
wrapper = enzymeWrapper;
});
it('should update the state property _**`formOpen`**_ and call handleOpen when edit button is clicked', () => {
const button = wrapper.find('Button').first();
button.simulate('click');
expect(ResetPasswordCard.prototype.handleSubmit.calledOnce).toBe(true);
});

it('should display current values in edit fields', () => {
const input = wrapper.find('InputField');
const mockedEvent = { target: {} };
input.simulate('change', mockedEvent);

expect(ResetPasswordCard.prototype.handleEmail.calledOnce).toBe(true);
});
});
});
2 changes: 1 addition & 1 deletion src/test/components/heading.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import { Heading } from '../../components/Heading/heading';
import { Heading } from '../../components/Heading/Heading';

const setUp = (props = {}) => {
const component = shallow(<Heading {...props} title="create an account" />);
Expand Down
36 changes: 18 additions & 18 deletions src/test/reducers/resetPassword.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ describe('reset password reducer', () => {
});

it('should handle LOADING', () => {
expect(
reducer(initialState,
{
type: 'LOADING',
}),
).toMatchSnapshot();
expect(reducer(
initialState,
{
type: 'LOADING',
},
)).toMatchSnapshot();
});
it('should handle PASSWORD_RESET_ERROR', () => {
expect(
reducer(initialState,
{
type: 'PASSWORD_RESET_ERROR',
}),
).toMatchSnapshot();
expect(reducer(
initialState,
{
type: 'PASSWORD_RESET_ERROR',
},
)).toMatchSnapshot();
});
it('should handle PASSWORD_RESET_SUCCESS', () => {
expect(
reducer(initialState,
{
type: 'PASSWORD_RESET_SUCCESS',
}),
).toMatchSnapshot();
expect(reducer(
initialState,
{
type: 'PASSWORD_RESET_SUCCESS',
},
)).toMatchSnapshot();
});
});
26 changes: 0 additions & 26 deletions store/reducers/authReducer.js~HEAD

This file was deleted.

0 comments on commit bc788b3

Please sign in to comment.