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

Commit

Permalink
feat(#105): started with auth login test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Gasser committed Apr 17, 2019
1 parent c434a56 commit d7701ca
Show file tree
Hide file tree
Showing 6 changed files with 2,244 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/auth/AuthComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ AuthFooter.propTypes = {
href: PropTypes.string.isRequired,
};

export const __testables__ = {
StyledAuthFooter,
StyledAuthHeader,
};

41 changes: 41 additions & 0 deletions src/auth/__tests__/AuthComponent.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react';
import { mount } from 'enzyme';
import toJson from 'enzyme-to-json';
import 'jest-styled-components';

import { MemoryRouter } from 'react-router-dom';

import { AuthHeader, AuthFooter, __testables__ } from '../AuthComponents';

describe('AuthComponent test suite', () => {
describe('AuthHeader test suite', () => {
it('should render with children', () => {
const children = <p>children</p>;
const wrapper = mount(<AuthHeader>{children}</AuthHeader>);
expect(wrapper).toBeTruthy();

expect(toJson(wrapper)).toMatchSnapshot();
});
});

describe('AuthFooter test suite', () => {
const getFooter = (props) => {
const wrapper = mount(
<MemoryRouter>
<AuthFooter {...props} />
</MemoryRouter>
);
return wrapper.find(AuthFooter);
}

it('should render with children', () => {
const href = 'http://www.google.com';
const children = <p>children</p>;

const wrapper = getFooter({ href, children });
expect(wrapper).toBeTruthy();

expect(toJson(wrapper)).toMatchSnapshot();
});
});
});
Loading

0 comments on commit d7701ca

Please sign in to comment.