-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PWA-1003: Increase Test Coverage in venia-ui/lib/components/CreateAcc…
…ountPage (#3021) - assert it renders correctly Co-authored-by: Devagouda <40405790+dpatil-magento@users.noreply.github.com>
- Loading branch information
1 parent
39ceaa3
commit c005187
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...i/lib/components/CreateAccountPage/__tests__/__snapshots__/createAccountPage.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
28 changes: 28 additions & 0 deletions
28
packages/venia-ui/lib/components/CreateAccountPage/__tests__/createAccountPage.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); |