-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8bf8bb0
commit ee03f03
Showing
3 changed files
with
43 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
SetPasscode, | ||
mapDispatchToProps as dispatchProps, | ||
} from './SetPasscode'; | ||
|
||
import { SET_PASSCODE } from '../redux/modules/settings'; | ||
|
||
describe('SetPasscode screen test', () => { | ||
it('should render as expected', () => { | ||
const wrapper = shallow(<SetPasscode />); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
describe('mapDispatchToProps test', () => { | ||
it('should set the hashed passcode on submit and go back one route', () => { | ||
const dispatchMock = jest.fn(); | ||
const ownPropsMock = { | ||
navigation: { | ||
goBack: jest.fn(), | ||
}, | ||
}; | ||
const props = dispatchProps(dispatchMock, ownPropsMock); | ||
props.handlePasscodeSubmit('password'); | ||
expect(dispatchMock.mock.calls.length).toBe(1); | ||
expect(dispatchMock.mock.calls[0]).toEqual([ | ||
{ | ||
passcodeHash: | ||
'5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8', | ||
type: SET_PASSCODE, | ||
}, | ||
]); | ||
|
||
expect(ownPropsMock.navigation.goBack.mock.calls.length).toBe(1); | ||
}); | ||
}); | ||
}); |
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,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`SetPasscode screen test should render as expected 1`] = `<PasscodeForm />`; |