Skip to content

Commit

Permalink
test(Settings): tests for recovery phrase in settings reducer
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed Jan 8, 2019
1 parent d45287d commit d3d1ecf
Showing 1 changed file with 37 additions and 0 deletions.
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
)
})
})

0 comments on commit d3d1ecf

Please sign in to comment.