2017-11-17 16:12:27 -05:00
|
|
|
import { rates, INITIAL_STATE } from 'reducers/rates';
|
|
|
|
import * as ratesActions from 'actions/rates';
|
2018-02-07 17:59:55 -06:00
|
|
|
import { CCResponse } from 'api/rates';
|
2017-11-17 16:12:27 -05:00
|
|
|
|
|
|
|
describe('rates reducer', () => {
|
|
|
|
it('should handle RATES_FETCH_CC_SUCCEEDED', () => {
|
2018-02-07 17:59:55 -06:00
|
|
|
const fakeCCResp: CCResponse = {
|
2017-11-18 13:15:02 -07:00
|
|
|
ETH: {
|
|
|
|
USD: 0,
|
2017-11-17 16:12:27 -05:00
|
|
|
BTC: 1,
|
|
|
|
EUR: 2,
|
|
|
|
GBP: 3,
|
|
|
|
CHF: 4,
|
|
|
|
REP: 5,
|
|
|
|
ETH: 6
|
|
|
|
}
|
|
|
|
};
|
2017-11-18 13:15:02 -07:00
|
|
|
|
2018-01-15 04:57:09 -05:00
|
|
|
expect(rates(undefined, ratesActions.fetchCCRatesSucceeded(fakeCCResp))).toEqual({
|
2017-11-17 16:12:27 -05:00
|
|
|
...INITIAL_STATE,
|
|
|
|
rates: {
|
|
|
|
...INITIAL_STATE.rates,
|
2017-11-18 13:15:02 -07:00
|
|
|
...fakeCCResp
|
2017-11-17 16:12:27 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle RATES_FETCH_CC_FAILED', () => {
|
2018-01-15 04:57:09 -05:00
|
|
|
expect(rates(undefined, ratesActions.fetchCCRatesFailed())).toHaveProperty('ratesError');
|
2017-11-17 16:12:27 -05:00
|
|
|
});
|
|
|
|
});
|