2017-11-17 21:12:27 +00:00
|
|
|
import { rates, INITIAL_STATE } from 'reducers/rates';
|
|
|
|
import * as ratesActions from 'actions/rates';
|
2018-02-07 23:59:55 +00:00
|
|
|
import { CCResponse } from 'api/rates';
|
2017-11-17 21:12:27 +00:00
|
|
|
|
|
|
|
describe('rates reducer', () => {
|
|
|
|
it('should handle RATES_FETCH_CC_SUCCEEDED', () => {
|
2018-02-07 23:59:55 +00:00
|
|
|
const fakeCCResp: 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
|
|
|
|
2018-01-15 09:57:09 +00:00
|
|
|
expect(rates(undefined, ratesActions.fetchCCRatesSucceeded(fakeCCResp))).toEqual({
|
2017-11-17 21:12:27 +00:00
|
|
|
...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', () => {
|
2018-01-15 09:57:09 +00:00
|
|
|
expect(rates(undefined, ratesActions.fetchCCRatesFailed())).toHaveProperty('ratesError');
|
2017-11-17 21:12:27 +00:00
|
|
|
});
|
|
|
|
});
|