zepio/__tests__/actions/wallet-summary.test.js

62 lines
1.4 KiB
JavaScript
Raw Normal View History

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,
addresses: [],
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
});