-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(Settings): tests for recovery phrase in settings reducer
- Loading branch information
Philip Welber
committed
Jan 8, 2019
1 parent
d45287d
commit d3d1ecf
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
packages/blockchain-wallet-v4-frontend/src/data/modules/settings/reducers.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,37 @@ | ||
import { assoc } from 'ramda' | ||
import reducer from './reducers' | ||
import * as actions from './actions' | ||
|
||
const INITIAL_STATE = {} | ||
|
||
describe('settings reducers', () => { | ||
it('should return the initial state', () => { | ||
expect(reducer(undefined, {})).toEqual(INITIAL_STATE) | ||
}) | ||
|
||
it('should handle ADD_MNEMONIC', () => { | ||
const action = actions.addMnemonic({ | ||
mnemonic: ['hello', 'world'] | ||
}) | ||
const expectedState = assoc( | ||
'recovery_phrase', | ||
['hello', 'world'], | ||
INITIAL_STATE | ||
) | ||
expect(reducer(INITIAL_STATE, action)).toEqual(expectedState) | ||
}) | ||
|
||
it('should handle CLEAR_EMAIL_CODE_FAILURE', () => { | ||
const action = actions.clearEmailCodeFailure() | ||
const expectedState = assoc('emailVerifiedError', false, INITIAL_STATE) | ||
expect(reducer(INITIAL_STATE, action)).toEqual(expectedState) | ||
}) | ||
|
||
it('should handle REMOVE_RECOVERY_PHRASE', () => { | ||
const action = actions.removeRecoveryPhrase() | ||
const expectedState = INITIAL_STATE | ||
expect(reducer({ recovery_phrase: ['foo', 'bar'] }, action)).toEqual( | ||
expectedState | ||
) | ||
}) | ||
}) |