Skip to content

Commit

Permalink
test(Coinify): test initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed Jul 3, 2018
1 parent 9c079bc commit 3464ca5
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,57 @@ describe('coinifySagas', () => {
.put(coinifyActions.coinifyNotAsked())
})
})

describe('coinify prepareAddress', () => {
const { prepareAddress } = coinifySagas({
coreSagas
})

const saga = testSaga(prepareAddress)

it('should select the state', () => {
saga.next().select()
})
})

describe('initialized', () => {
let { initialized } = coinifySagas({
coreSagas
})
const action = {
payload: {
type: 'buy'
}
}

let saga = testSaga(initialized, action)

it('selects the level', () => {
saga.next().select(selectors.core.data.coinify.getLevel)
})

it('intializes if type is buy', () => {
const level = { currency: 'EUR' }
const initialValues = {
leftVal: '',
rightVal: '',
currency: level.currency
}
saga.next(Remote.of(level)).put(actions.form.initialize('coinifyCheckoutBuy', initialValues))
})

it('fetches a rate quote', () => {
const currency = 'EUR'
const type = 'buy'
saga.next().put(actions.core.data.coinify.fetchRateQuote(currency, type))
})

it('sets coinifyCheckoutError', () => {
saga.next().put(coinifyActions.setCoinifyCheckoutError(false))
})

it('sets busy on', () => {
saga.next().put(coinifyActions.coinifyCheckoutBusyOn())
})
})
})

0 comments on commit 3464ca5

Please sign in to comment.