mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +00:00
e7f88a6a0a
* Use shapeshift for all swaps. * Replace existing redux-promise-middleware based CCRequest action with saga based action. * Remove module from package.json, store middleware, webpack_config. * fix snapshot * Add return typing * Add test for saga
28 lines
992 B
TypeScript
28 lines
992 B
TypeScript
import { fetchRatesSaga } from 'sagas/rates';
|
|
import { call, put } from 'redux-saga/effects';
|
|
import { fetchCCRatesSucceeded, fetchCCRatesFailed, fetchCCRatesRequested } from 'actions/rates';
|
|
import { fetchRates } from 'api/rates';
|
|
describe('fetch rates saga success', () => {
|
|
const saga = fetchRatesSaga(fetchCCRatesRequested());
|
|
it('should fetch the rates', () => {
|
|
expect(saga.next().value).toEqual(call(fetchRates, []));
|
|
});
|
|
it('should dispatch a success action', () => {
|
|
expect(saga.next({}).value).toEqual(put(fetchCCRatesSucceeded({})));
|
|
});
|
|
it('should be done', () => {
|
|
expect(saga.next().done).toEqual(true);
|
|
});
|
|
});
|
|
|
|
describe('fetch rates saga failure', () => {
|
|
const saga = fetchRatesSaga(fetchCCRatesRequested());
|
|
it('it should throw and dispatch a failure action', () => {
|
|
saga.next();
|
|
expect(saga.throw!().value).toEqual(put(fetchCCRatesFailed()));
|
|
});
|
|
it('should be done', () => {
|
|
expect(saga.next().done).toEqual(true);
|
|
});
|
|
});
|