5 changed files with 332 additions and 1 deletions
@ -0,0 +1,169 @@ |
|||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly getInvoice 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": true, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly getInvoices 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": true, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly invcoiceFailed 1`] = ` |
||||
|
Object { |
||||
|
"data": null, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly invcoiceSuccessful 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [ |
||||
|
"foo", |
||||
|
], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly receiveFormInvoice 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"payreq": "foo", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly receiveInvoice 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": "foo", |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly receiveInvoices 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [ |
||||
|
1, |
||||
|
2, |
||||
|
], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly searchInvoices 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "foo", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly sendInvoice 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": true, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should correctly setInvoice 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": "foo", |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers invoiceReducer should handle initial state 1`] = ` |
||||
|
Object { |
||||
|
"data": Object {}, |
||||
|
"formInvoice": Object { |
||||
|
"amount": "0", |
||||
|
"payreq": "", |
||||
|
"r_hash": "", |
||||
|
}, |
||||
|
"invoice": null, |
||||
|
"invoiceLoading": false, |
||||
|
"invoices": Array [], |
||||
|
"invoicesSearchText": "", |
||||
|
} |
||||
|
`; |
@ -0,0 +1,46 @@ |
|||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
|
||||
|
exports[`reducers paymentReducer should correctly getPayments 1`] = ` |
||||
|
Object { |
||||
|
"payment": null, |
||||
|
"paymentLoading": true, |
||||
|
"payments": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers paymentReducer should correctly paymentSuccessful 1`] = ` |
||||
|
Object { |
||||
|
"payment": null, |
||||
|
"paymentLoading": false, |
||||
|
"payments": Array [ |
||||
|
"foo", |
||||
|
], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers paymentReducer should correctly receivePayments 1`] = ` |
||||
|
Object { |
||||
|
"payment": null, |
||||
|
"paymentLoading": false, |
||||
|
"payments": Array [ |
||||
|
1, |
||||
|
2, |
||||
|
], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers paymentReducer should correctly sendPayment 1`] = ` |
||||
|
Object { |
||||
|
"payment": "foo", |
||||
|
"paymentLoading": false, |
||||
|
"payments": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers paymentReducer should handle initial state 1`] = ` |
||||
|
Object { |
||||
|
"payment": null, |
||||
|
"paymentLoading": false, |
||||
|
"payments": Array [], |
||||
|
} |
||||
|
`; |
@ -0,0 +1,52 @@ |
|||||
|
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() |
||||
|
}) |
||||
|
}) |
||||
|
}) |
Loading…
Reference in new issue