Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
fix(#107): fixed failing test cases and removed prop type warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gasser committed May 8, 2019
1 parent b51385f commit 3945c47
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 96 deletions.
1 change: 1 addition & 0 deletions src/app/Privacy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const PrivacyView = () => (
This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use
our Service and the choices you have associated with that data. Our Privacy Policy for Rekognition is managed with
the help of
{' '}
<a href="https://privacypolicies.com/free-privacy-policy-generator/">Privacy Policies</a>
</p>

Expand Down
44 changes: 26 additions & 18 deletions src/app/__tests__/__snapshots__/Privacy.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ exports[`Privacy test suite should render consistently 1`] = `
.c2 {
margin-top: 12px;
margin-bottom: 0px;
font-size: 18px;
line-height: 24px;
max-width: 432px;
font-size: 50px;
line-height: 56px;
max-width: 1200px;
font-weight: 600;
}
Expand Down Expand Up @@ -63,9 +63,9 @@ exports[`Privacy test suite should render consistently 1`] = `
@media only screen and (max-width:768px) {
.c2 {
font-size: 18px;
line-height: 24px;
max-width: 432px;
font-size: 34px;
line-height: 40px;
max-width: 816px;
}
}
Expand Down Expand Up @@ -6896,7 +6896,7 @@ string",
className="c0 c1"
>
<Heading
level="4"
level={1}
margin={
Object {
"bottom": "none",
Expand All @@ -6906,8 +6906,8 @@ string",
responsive={true}
>
<StyledHeading
as="h4"
level={4}
as="h1"
level={1}
margin={
Object {
"bottom": "none",
Expand Down Expand Up @@ -7793,7 +7793,7 @@ string",
}
>
<StyledComponent
as="h4"
as="h1"
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
Expand Down Expand Up @@ -7834,7 +7834,7 @@ string",
}
}
forwardedRef={null}
level={4}
level={1}
margin={
Object {
"bottom": "none",
Expand Down Expand Up @@ -8719,28 +8719,30 @@ string",
}
}
>
<h4
<h1
className="c2"
>
Privacy Policy
</h4>
</h1>
</StyledComponent>
</StyledHeading>
</Heading>
<p>
Effective date: September 20, 2018
</p>
<p>
Rekognition ("us", "we", or "our") operates the www.rekognition.gasserandreas.com website and the Rekognition mobile application (hereinafter referred to as the "Service").
Rekognition ("us", "we", or "our") operates the
www.rekognition.gasserandreas.com website and the Rekognition mobile application (hereinafter referred to as the "Service").
</p>
<p>
This page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data. Our Privacy Policy for Rekognition is managed with the help of
<a
href="https://privacypolicies.com/free-privacy-policy-generator/"
>
Privacy Policies
</a>
.
</p>
<p>
We use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, the terms used in this Privacy Policy have the same meanings as in our Terms and Conditions.
Expand All @@ -8758,7 +8760,9 @@ string",
Personal Data
</h4>
<p>
While using our Service, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you ("Personal Data"). Personally identifiable information may include, but is not limited to:
While using our Service, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you ("Personal Data"). Personally identifiable information
may include, but is not limited to:
</p>
<ul>
<li>
Expand Down Expand Up @@ -8898,7 +8902,9 @@ string",
Service Providers
</h2>
<p>
We may employ third party companies and individuals to facilitate our Service ("Service Providers"), to provide the Service on our behalf, to perform Service-related services or to assist us in analyzing how our Service is used.
We may employ third party companies and individuals to facilitate our
Service ("Service Providers"), to provide the Service on our behalf, to perform Service-related services or to assist us in analyzing how our Service is used.
</p>
<p>
These third parties have access to your Personal Data only to perform these tasks on our behalf and are obligated not to disclose or use it for any other purpose.
Expand Down Expand Up @@ -8933,7 +8939,9 @@ string",
Links To Other Sites
</h2>
<p>
Our Service may contain links to other sites that are not operated by us. If you click on a third party link, you will be directed to that third party's site. We strongly advise you to review the Privacy Policy of every site you visit.
Our Service may contain links to other sites that are not operated by us. If you click on a third party link, you will be directed to that third party's site. We strongly advise
you to review the Privacy Policy of every site you visit.
</p>
<p>
We have no control over and assume no responsibility for the content, privacy policies or practices of any third party sites or services.
Expand Down
6 changes: 3 additions & 3 deletions src/auth/login/__tests__/LoginForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Login form test suite', () => {
errors: inputFields.reduce(
(prev, cur) => ({
...prev,
[cur]: true,
[cur]: `Error ${cur}`,
}),
{},
),
Expand Down Expand Up @@ -89,7 +89,7 @@ describe('Login form test suite', () => {
errors: inputFields.reduce(
(prev, cur) => ({
...prev,
[cur]: true,
[cur]: `Error: ${cur}`,
}),
{},
),
Expand All @@ -115,7 +115,7 @@ describe('Login form test suite', () => {
it('should show error message if error props is set', () => {
const props = {
...getFormProps(),
error: true,
error: 'custom error',
};
const wrapper = mount(<LoginForm {...props} />);
expect(wrapper).toBeTruthy();
Expand Down
2 changes: 1 addition & 1 deletion src/auth/login/__tests__/LoginView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('LoginView test suite', () => {
beforeEach(() => {
initialProps = {
isAuthenticated: false,
histroy: {
history: {
push: jest.fn(),
},
loginRequest: {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/register/CheckEmailForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const CheckEmailForm = (props) => {

CheckEmailForm.propTypes = {
error: PropTypes.node,
validEmail: PropTypes.string,
validEmail: PropTypes.bool,
values: PropTypes.shape({}).isRequired,
touched: PropTypes.shape({}).isRequired,
errors: PropTypes.shape({}).isRequired,
Expand Down
35 changes: 23 additions & 12 deletions src/auth/register/__tests__/CheckEmailForm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ describe('Register form test suite', () => {
return props;
};

const defaultProps = {
error: '',
};

const getCheckEmailForm = props => mount(
<CheckEmailForm
{...defaultProps}
{...props}
/>,
);

it('should render', () => {
const props = getFormProps();
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
expect(wrapper).toBeTruthy();
});

Expand All @@ -44,12 +55,12 @@ describe('Register form test suite', () => {
errors: inputFields.reduce(
(prev, cur) => ({
...prev,
[cur]: true,
[cur]: `Error ${cur}`,
}),
{},
),
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);

// test fields
const fields = wrapper.find(Field);
Expand Down Expand Up @@ -78,12 +89,12 @@ describe('Register form test suite', () => {
errors: inputFields.reduce(
(prev, cur) => ({
...prev,
[cur]: true,
[cur]: `Error: ${cur}`,
}),
{},
),
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);

// test fields
const fields = wrapper.find(Field);
Expand All @@ -104,7 +115,7 @@ describe('Register form test suite', () => {
...getFormProps(),
error,
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
expect(wrapper).toBeTruthy();

// check for error message
Expand All @@ -119,7 +130,7 @@ describe('Register form test suite', () => {
...getFormProps(),
validEmail,
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
expect(wrapper).toBeTruthy();

// check for error message
Expand All @@ -134,7 +145,7 @@ describe('Register form test suite', () => {
dirty: true,
submitting: true,
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
const resetButton = wrapper.find(Button).filterWhere(n => n.props().testId === 'jestResetButton');
expect(resetButton.props().disabled).toBeTruthy();
});
Expand All @@ -144,7 +155,7 @@ describe('Register form test suite', () => {
...getFormProps(),
submitting: true,
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
const submitButton = wrapper.find(Button).filterWhere(n => n.props().testId === 'jestSubmitButton');
expect(submitButton.props().disabled).toBeTruthy();
});
Expand All @@ -154,14 +165,14 @@ describe('Register form test suite', () => {
...getFormProps(),
submitting: true,
};
const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
const submitButton = wrapper.find(Button).filterWhere(n => n.props().testId === 'jestSubmitButton');
expect(submitButton.props().loading).toBeTruthy();
});

// important to trigger Formik
it('submit button should be type of submit', () => {
const wrapper = mount(<CheckEmailForm {...getFormProps()} />);
const wrapper = getCheckEmailForm(getFormProps());
const submitButton = wrapper.find(Button).filterWhere(n => n.props().testId === 'jestSubmitButton');
expect(submitButton.props().type).toEqual('submit');
});
Expand All @@ -174,7 +185,7 @@ describe('Register form test suite', () => {
dirty: true,
};

const wrapper = mount(<CheckEmailForm {...props} />);
const wrapper = getCheckEmailForm(props);
const resetButton = wrapper.find(Button).filterWhere(n => n.props().testId === 'jestResetButton');
expect(resetButton.exists()).toBeTruthy();

Expand Down
Loading

0 comments on commit 3945c47

Please sign in to comment.