-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests, add test for confirmation screen
Signed-off-by: Christian Lippa <[email protected]>
- Loading branch information
1 parent
42ab907
commit 4980b42
Showing
3 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
packages/legacy/core/__tests__/screens/PINChangeConfirmation.test.tsx
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,43 @@ | ||
import { render } from '@testing-library/react-native' | ||
import React from 'react' | ||
|
||
import { AuthContext } from '../../App/contexts/auth' | ||
import { StoreProvider, defaultState } from '../../App/contexts/store' | ||
import PINChangeConfirmation from '../../App/screens/PINChangeConfirmation' | ||
import { testIdWithKey } from '../../App/utils/testable' | ||
import authContext from '../contexts/auth' | ||
import { MainContainer } from '../../App/container-impl' | ||
import { container } from 'tsyringe' | ||
import { ContainerProvider } from '../../App/container-api' | ||
|
||
describe('PINChange Screen', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
test('PIN change renders correctly', async () => { | ||
const main = new MainContainer(container.createChildContainer()).init() | ||
const tree = render( | ||
<ContainerProvider value={main}> | ||
<StoreProvider | ||
initialState={{ | ||
...defaultState, | ||
}} | ||
> | ||
<AuthContext.Provider value={authContext}> | ||
<PINChangeConfirmation /> | ||
</AuthContext.Provider> | ||
</StoreProvider> | ||
</ContainerProvider> | ||
) | ||
|
||
// Causes RangeError: Invalid string length | ||
// expect(tree).toMatchSnapshot() | ||
const confirmationInfoBoxTitle = tree.getByTestId(testIdWithKey('HeaderText')) | ||
const confirmationInfoBoxSubtext = tree.getByTestId(testIdWithKey('BodyText')) | ||
const backToHomeButton = tree.getByTestId(testIdWithKey('GoToHomeButton')) | ||
expect(confirmationInfoBoxTitle).not.toBe(null) | ||
expect(confirmationInfoBoxSubtext).not.toBe(null) | ||
expect(backToHomeButton).not.toBe(null) | ||
}) | ||
}) |