You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
1.5 KiB

import paymentReducer, {
SET_PAYMENT,
GET_PAYMENTS,
RECEIVE_PAYMENTS,
SEND_PAYMENT,
PAYMENT_SUCCESSFULL,
PAYMENT_FAILED
} from '../../app/reducers/payment'
describe('reducers', () => {
describe('paymentReducer', () => {
it('should handle initial state', () => {
expect(paymentReducer(undefined, {})).toMatchSnapshot()
})
it('should have SET_PAYMENT', () => {
expect(SET_PAYMENT).toEqual('SET_PAYMENT')
})
it('should have RECEIVE_PAYMENTS', () => {
expect(RECEIVE_PAYMENTS).toEqual('RECEIVE_PAYMENTS')
})
it('should have SEND_PAYMENT', () => {
expect(SEND_PAYMENT).toEqual('SEND_PAYMENT')
})
it('should have PAYMENT_SUCCESSFULL', () => {
expect(PAYMENT_SUCCESSFULL).toEqual('PAYMENT_SUCCESSFULL')
})
it('should have PAYMENT_FAILED', () => {
expect(PAYMENT_FAILED).toEqual('PAYMENT_FAILED')
})
it('should correctly sendPayment', () => {
expect(paymentReducer(undefined, { type: SET_PAYMENT, payment: 'foo' })).toMatchSnapshot()
})
it('should correctly getPayments', () => {
expect(paymentReducer(undefined, { type: GET_PAYMENTS })).toMatchSnapshot()
})
it('should correctly receivePayments', () => {
expect(paymentReducer(undefined, { type: RECEIVE_PAYMENTS, payments: [1, 2] })).toMatchSnapshot()
})
it('should correctly paymentSuccessful', () => {
expect(paymentReducer(undefined, { type: PAYMENT_SUCCESSFULL, payment: 'foo' })).toMatchSnapshot()
})
})
})