Browse Source
fix(wallet): fetch updated channels and balance after a new transactionrenovate/lint-staged-8.x
JimmyMow
6 years ago
committed by
GitHub
4 changed files with 224 additions and 6 deletions
@ -0,0 +1,123 @@ |
|||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly addTransaction 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [ |
||||
|
undefined, |
||||
|
], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly getTransactions 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": true, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly hideSuccessTransactionScreen 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly receiveTransactions 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": undefined, |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly sendTransaction 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": true, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly sendTransactions 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": true, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly showSuccessTransactionScreen 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": true, |
||||
|
"txid": undefined, |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly transactionFailed 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should correctly transactionSuccessful 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
||||
|
|
||||
|
exports[`reducers transactionReducer should handle initial state 1`] = ` |
||||
|
Object { |
||||
|
"sendingTransaction": false, |
||||
|
"successTransactionScreen": Object { |
||||
|
"show": false, |
||||
|
"txid": "", |
||||
|
}, |
||||
|
"transactionLoading": false, |
||||
|
"transactions": Array [], |
||||
|
} |
||||
|
`; |
@ -0,0 +1,90 @@ |
|||||
|
import transactionReducer, { |
||||
|
GET_TRANSACTIONS, |
||||
|
RECEIVE_TRANSACTIONS, |
||||
|
SEND_TRANSACTION, |
||||
|
TRANSACTION_SUCCESSFULL, |
||||
|
TRANSACTION_FAILED, |
||||
|
ADD_TRANSACTION, |
||||
|
SHOW_SUCCESS_TRANSACTION_SCREEN, |
||||
|
HIDE_SUCCESS_TRANSACTION_SCREEN |
||||
|
} from 'reducers/transaction' |
||||
|
|
||||
|
describe('reducers', () => { |
||||
|
describe('transactionReducer', () => { |
||||
|
it('should handle initial state', () => { |
||||
|
expect(transactionReducer(undefined, {})).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should have GET_TRANSACTIONS', () => { |
||||
|
expect(GET_TRANSACTIONS).toEqual('GET_TRANSACTIONS') |
||||
|
}) |
||||
|
|
||||
|
it('should have RECEIVE_TRANSACTIONS', () => { |
||||
|
expect(RECEIVE_TRANSACTIONS).toEqual('RECEIVE_TRANSACTIONS') |
||||
|
}) |
||||
|
|
||||
|
it('should have GET_TICKER', () => { |
||||
|
expect(SEND_TRANSACTION).toEqual('SEND_TRANSACTION') |
||||
|
}) |
||||
|
|
||||
|
it('should have TRANSACTION_SUCCESSFULL', () => { |
||||
|
expect(TRANSACTION_SUCCESSFULL).toEqual('TRANSACTION_SUCCESSFULL') |
||||
|
}) |
||||
|
|
||||
|
it('should have TRANSACTION_FAILED', () => { |
||||
|
expect(TRANSACTION_FAILED).toEqual('TRANSACTION_FAILED') |
||||
|
}) |
||||
|
|
||||
|
it('should have ADD_TRANSACTION', () => { |
||||
|
expect(ADD_TRANSACTION).toEqual('ADD_TRANSACTION') |
||||
|
}) |
||||
|
|
||||
|
it('should have SHOW_SUCCESS_TRANSACTION_SCREEN', () => { |
||||
|
expect(SHOW_SUCCESS_TRANSACTION_SCREEN).toEqual('SHOW_SUCCESS_TRANSACTION_SCREEN') |
||||
|
}) |
||||
|
|
||||
|
it('should have HIDE_SUCCESS_TRANSACTION_SCREEN', () => { |
||||
|
expect(HIDE_SUCCESS_TRANSACTION_SCREEN).toEqual('HIDE_SUCCESS_TRANSACTION_SCREEN') |
||||
|
}) |
||||
|
|
||||
|
it('should correctly getTransactions', () => { |
||||
|
expect(transactionReducer(undefined, { type: GET_TRANSACTIONS })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly sendTransactions', () => { |
||||
|
expect(transactionReducer(undefined, { type: SEND_TRANSACTION })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly receiveTransactions', () => { |
||||
|
expect(transactionReducer(undefined, { type: RECEIVE_TRANSACTIONS })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly sendTransaction', () => { |
||||
|
expect(transactionReducer(undefined, { type: SEND_TRANSACTION })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly transactionSuccessful', () => { |
||||
|
expect(transactionReducer(undefined, { type: TRANSACTION_SUCCESSFULL })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly transactionFailed', () => { |
||||
|
expect(transactionReducer(undefined, { type: TRANSACTION_FAILED })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly addTransaction', () => { |
||||
|
expect(transactionReducer(undefined, { type: ADD_TRANSACTION })).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly showSuccessTransactionScreen', () => { |
||||
|
expect( |
||||
|
transactionReducer(undefined, { type: SHOW_SUCCESS_TRANSACTION_SCREEN }) |
||||
|
).toMatchSnapshot() |
||||
|
}) |
||||
|
|
||||
|
it('should correctly hideSuccessTransactionScreen', () => { |
||||
|
expect( |
||||
|
transactionReducer(undefined, { type: HIDE_SUCCESS_TRANSACTION_SCREEN }) |
||||
|
).toMatchSnapshot() |
||||
|
}) |
||||
|
}) |
||||
|
}) |
Loading…
Reference in new issue