2017-11-17 21:12:27 +00:00
|
|
|
import { rates, INITIAL_STATE } from 'reducers/rates';
|
|
|
|
import * as ratesActions from 'actions/rates';
|
|
|
|
|
|
|
|
describe('rates reducer', () => {
|
|
|
|
it('should handle RATES_FETCH_CC_SUCCEEDED', () => {
|
|
|
|
const fakeCCResp: ratesActions.CCResponse = {
|
2017-11-18 20:15:02 +00:00
|
|
|
ETH: {
|
|
|
|
USD: 0,
|
2017-11-17 21:12:27 +00:00
|
|
|
BTC: 1,
|
|
|
|
EUR: 2,
|
|
|
|
GBP: 3,
|
|
|
|
CHF: 4,
|
|
|
|
REP: 5,
|
|
|
|
ETH: 6
|
|
|
|
}
|
|
|
|
};
|
2017-11-18 20:15:02 +00:00
|
|
|
|
2017-11-17 21:12:27 +00:00
|
|
|
expect(
|
|
|
|
rates(undefined, ratesActions.fetchCCRatesSucceeded(fakeCCResp))
|
|
|
|
).toEqual({
|
|
|
|
...INITIAL_STATE,
|
|
|
|
rates: {
|
|
|
|
...INITIAL_STATE.rates,
|
2017-11-18 20:15:02 +00:00
|
|
|
...fakeCCResp
|
2017-11-17 21:12:27 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle RATES_FETCH_CC_FAILED', () => {
|
|
|
|
expect(rates(undefined, ratesActions.fetchCCRatesFailed())).toHaveProperty(
|
|
|
|
'ratesError'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|