Skip to content
Snippets Groups Projects
Commit 2bbdef2a authored by Bucknell, Mary S.'s avatar Bucknell, Mary S.
Browse files

Refined observations tests

parent 75111e40
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,9 @@
import './polyfills';
/*
import './web-services/observations.spec';
*/
import './store/observations.spec';
/*
import './ajax.spec';
import './d3-rendering/accessibility.spec';
......@@ -77,8 +78,6 @@ import './store/flood-data-reducer.spec';
import './store/nldi-data-reducer.spec';
import './store/flood-state-reducer.spec';
import './store/index.spec';
import './store/observations-data-reducer.spec';
import './store/observations-state-reducer.spec';
import './store/series-reducer.spec';
import './store/time-series-state-reducer.spec';
import './store/ui-reducer.spec';
......
......@@ -126,12 +126,21 @@ fdescribe('store/observations module', () => {
const state = store.getState();
expect(state.observationsData.dvTimeSeries).toBeDefined();
expect(state.observationsData.dvTimeSeries.ffff345).toBeDefined();
expect(state.observationsData.dvTimeSeries.ffff345.id = 'USGS-1234567-ffff345');
expect(state.observationsData.dvTimeSeries.ffff345.id).toEqual('USGS-12345678-ffff345');
expect(state.observationsState.currentDVTimeSeriesId).toEqual('ffff345');
done();
});
});
it('Expects that if the time series has already been fetched, the data is not refetched', () => {
store.dispatch(Actions.addDVTimeSeries('ffff345', {id: 'ffff345'}));
store.dispatch(Actions.retrieveDVTimeSeries('USGS-12345678', 'ffff345'));
expect(jasmine.Ajax.requests.count()).toBe(0);
expect(store.getState().observationsState.currentDVTimeSeriesId).toEqual('ffff345');
});
it('Expects a bad fetch request to not add a time series the store', (done) => {
const initPromise = store.dispatch(Actions.retrieveDVTimeSeries('USGS-12345678', 'ffff345'));
jasmine.Ajax.requests.mostRecent().respondWith({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment