2018-12-10 09:04:20 -08:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import configureStore from 'redux-mock-store';
|
|
|
|
|
2018-12-10 09:32:44 -08:00
|
|
|
import {
|
|
|
|
LOAD_WALLET_SUMMARY,
|
|
|
|
LOAD_WALLET_SUMMARY_SUCCESS,
|
|
|
|
LOAD_WALLET_SUMMARY_ERROR,
|
|
|
|
loadWalletSummary,
|
|
|
|
loadWalletSummarySuccess,
|
|
|
|
loadWalletSummaryError,
|
|
|
|
} from '../../app/redux/modules/wallet';
|
2018-12-10 09:04:20 -08:00
|
|
|
|
|
|
|
const store = configureStore()();
|
|
|
|
|
|
|
|
describe('WalletSummary Actions', () => {
|
|
|
|
beforeEach(() => store.clearActions());
|
|
|
|
|
|
|
|
test('should create an action to load wallet summary', () => {
|
|
|
|
store.dispatch(loadWalletSummary());
|
|
|
|
|
|
|
|
expect(store.getActions()[0]).toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
type: LOAD_WALLET_SUMMARY,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
2018-12-10 09:32:44 -08:00
|
|
|
|
|
|
|
test('should create an action to load wallet summary', () => {
|
|
|
|
const payload = {
|
|
|
|
total: 5000,
|
|
|
|
transparent: 5000,
|
|
|
|
shielded: 5000,
|
2018-12-10 16:08:51 -08:00
|
|
|
addresses: [],
|
2019-01-08 08:01:20 -08:00
|
|
|
transactions: [],
|
2018-12-13 13:37:15 -08:00
|
|
|
zecPrice: 50,
|
2018-12-10 09:32:44 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
store.dispatch(loadWalletSummarySuccess(payload));
|
|
|
|
|
|
|
|
expect(store.getActions()[0]).toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
type: LOAD_WALLET_SUMMARY_SUCCESS,
|
|
|
|
payload,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
test('should create an action to load wallet summary with error', () => {
|
|
|
|
const payload = {
|
|
|
|
error: 'Something went wrong!',
|
|
|
|
};
|
|
|
|
|
|
|
|
store.dispatch(loadWalletSummaryError(payload));
|
|
|
|
|
|
|
|
expect(store.getActions()[0]).toEqual(
|
|
|
|
expect.objectContaining({
|
|
|
|
type: LOAD_WALLET_SUMMARY_ERROR,
|
|
|
|
payload,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
});
|
2018-12-10 09:04:20 -08:00
|
|
|
});
|