Skip to content

Commit

Permalink
PWA-1003: Increase Test Coverage in venia-ui/lib/components/CreateAcc…
Browse files Browse the repository at this point in the history
…ountPage (#3021)

- assert it renders correctly

Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com>
  • Loading branch information
anthoula and dpatil-magento authored Feb 23, 2021
1 parent 39ceaa3 commit c005187
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`it renders correctly 1`] = `
<div
className="container"
>
<CreateAccountForm
initialValues={Object {}}
isCancelButtonHidden={true}
onSubmit={[MockFunction handleCreateAccount]}
/>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { createTestInstance } from '@magento/peregrine';
import { useCreateAccountPage } from '@magento/peregrine/lib/talons/CreateAccountPage/useCreateAccountPage';
import CreateAccountPage from '../createAccountPage';

jest.mock('../../../classify');
jest.mock(
'@magento/peregrine/lib/talons/CreateAccountPage/useCreateAccountPage'
);
jest.mock('../../CreateAccount', () => 'CreateAccountForm');

const handleCreateAccount = jest.fn().mockName('handleCreateAccount');

const props = {
initialValues: {}
};

const talonProps = {
handleCreateAccount,
initialValues: {}
};

test('it renders correctly', () => {
useCreateAccountPage.mockReturnValueOnce(talonProps);
const tree = createTestInstance(<CreateAccountPage {...props} />);

expect(tree.toJSON()).toMatchSnapshot();
});

0 comments on commit c005187

Please sign in to comment.