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.
64 lines
1.8 KiB
64 lines
1.8 KiB
import formReducer, {
|
|
SET_FORM,
|
|
SET_AMOUNT,
|
|
SET_MESSAGE,
|
|
SET_PUBKEY,
|
|
SET_PAYMENT_REQUEST,
|
|
RESET_FORM
|
|
} from '../../app/reducers/form'
|
|
|
|
describe('reducers', () => {
|
|
describe('formReducer', () => {
|
|
it('should handle initial state', () => {
|
|
expect(formReducer(undefined, {})).toMatchSnapshot()
|
|
})
|
|
|
|
it('should have SET_FORM', () => {
|
|
expect(SET_FORM).toEqual('SET_FORM')
|
|
})
|
|
|
|
it('should have SET_AMOUNT', () => {
|
|
expect(SET_AMOUNT).toEqual('SET_AMOUNT')
|
|
})
|
|
|
|
it('should have SET_MESSAGE', () => {
|
|
expect(SET_MESSAGE).toEqual('SET_MESSAGE')
|
|
})
|
|
|
|
it('should have SET_PUBKEY', () => {
|
|
expect(SET_PUBKEY).toEqual('SET_PUBKEY')
|
|
})
|
|
|
|
it('should have SET_PAYMENT_REQUEST', () => {
|
|
expect(SET_PAYMENT_REQUEST).toEqual('SET_PAYMENT_REQUEST')
|
|
})
|
|
|
|
it('should have RESET_FORM', () => {
|
|
expect(RESET_FORM).toEqual('RESET_FORM')
|
|
})
|
|
|
|
it('should correctly setForm', () => {
|
|
expect(formReducer(undefined, { type: SET_FORM, modalOpen: true, formType: 'foo' })).toMatchSnapshot()
|
|
})
|
|
|
|
it('should correctly setAmount', () => {
|
|
expect(formReducer(undefined, { type: SET_AMOUNT, amount: 1 })).toMatchSnapshot()
|
|
})
|
|
|
|
it('should correctly setMessage', () => {
|
|
expect(formReducer(undefined, { type: SET_MESSAGE, message: 'foo' })).toMatchSnapshot()
|
|
})
|
|
|
|
it('should correctly setPubkey', () => {
|
|
expect(formReducer(undefined, { type: SET_PUBKEY, pubkey: 'foo' })).toMatchSnapshot()
|
|
})
|
|
|
|
it('should correctly setPaymentRequest', () => {
|
|
expect(formReducer(undefined, { type: SET_PAYMENT_REQUEST, payment_request: 'foo' })).toMatchSnapshot()
|
|
})
|
|
|
|
it('should correctly resetForm', () => {
|
|
expect(formReducer(undefined, { type: RESET_FORM })).toMatchSnapshot()
|
|
})
|
|
})
|
|
})
|