diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/index.js b/assets/src/scripts/monitoring-location/components/hydrograph/index.js index cae79c2f43c48db9d8bf8eff002a56ae80ef7ef9..ada6cc23c8c44785d3e44a1f10f6eec7ca4dc8a5 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/index.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/index.js @@ -1,7 +1,7 @@ /** * Hydrograph charting module. */ -import {select, selectAll} from 'd3-selection'; +import {select} from 'd3-selection'; import {createStructuredSelector} from 'reselect'; import config from 'ui/config.js'; diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/time-series-data.spec.js b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/time-series-data.spec.js index 5719f63f42dfd392c83befef0d550613414c0502..59a745b81bd00999eba10a64c04349fbeefde429 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/time-series-data.spec.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/time-series-data.spec.js @@ -1,6 +1,6 @@ import { isVisible, getYLabel, getTitle, - getDescription, getTsTimeZone, getSecondaryYLabel} from './time-series-data'; + getDescription, getTsTimeZone, getSecondaryYLabel, getQueryInformation} from './time-series-data'; const TEST_DATA = { @@ -334,4 +334,37 @@ describe('monitoring-location/components/hydrograph/time-series module', () => { expect(result).toEqual('America/New_York'); }); }); + + describe('getQueryInformation', () => { + it('Returns the stored query information', () => { + const result = getQueryInformation(TEST_DATA); + const expectedObject = { + 'current:P7D': { + notes: { + requestDT: 1483994767572, + 'filter:timeRange': { + mode: 'PERIOD', + periodDays: 7, + modifiedSince: null + } + } + }, + 'current:P30D:00060': { + notes: { + requestDT: 1483994767572, + 'filter:timeRange': { + mode: 'RANGE', + interval: { + start: 1483941600000, + end: 1486533600000 + }, + modifiedSince: null + } + } + } + }; + + expect(result).toEqual(expectedObject); + }); + }); }); diff --git a/assets/src/scripts/monitoring-location/selectors/time-series-selector.spec.js b/assets/src/scripts/monitoring-location/selectors/time-series-selector.spec.js index 7f8866b43cc849bd9a2a36106018ab883c704fe5..f205208d9c7d85f67d1f032976b52fc86d56de37 100644 --- a/assets/src/scripts/monitoring-location/selectors/time-series-selector.spec.js +++ b/assets/src/scripts/monitoring-location/selectors/time-series-selector.spec.js @@ -1,5 +1,6 @@ import { getVariables, + getShowIVTimeSeries, getSourceInfo, getSiteCodes, getCurrentVariableID, @@ -232,6 +233,11 @@ const TEST_DATA = { } }, ivTimeSeriesState: { + showIVTimeSeries: { + current: true, + compare: true, + median: false + }, currentIVVariableID: '45807197', currentIVDateRange: 'P7D' } @@ -830,6 +836,18 @@ describe('monitoring-location/selectors/time-series-selector', () => { }); }); + describe('getShowIVTimeSeries', () => { + const expectedObject = { + current: true, + compare: true, + median: false + }; + it('Expects to return the selections for which time series are active', () => { + expect(getShowIVTimeSeries(TEST_DATA)).toEqual(expectedObject); + }); + }); + + describe('getTSRequest', () => { const TEST_DATA = { ivTimeSeriesData: { diff --git a/assets/src/scripts/web-services/models.js b/assets/src/scripts/web-services/models.js index 4fd318a3f51a65c31d17af46a45343a735aa49da..3fc7ed8f0725d1b8794db3b4a3f72b4ebe3f25c1 100644 --- a/assets/src/scripts/web-services/models.js +++ b/assets/src/scripts/web-services/models.js @@ -1,6 +1,8 @@ import {utcFormat} from 'd3-time-format'; -import config from 'ui/config'; + import {get} from 'ui/ajax'; +import config from 'ui/config'; + // Define Water Services root URL - use global variable if defined, otherwise // use production.