From 42959b2e08f6f77089bef982feaa577f530b6a8f Mon Sep 17 00:00:00 2001
From: Aaron Briggs <abriggs@contractor.usgs.gov>
Date: Thu, 19 Nov 2020 15:37:36 -0600
Subject: [PATCH] clean and add a couple tests

---
 .../components/hydrograph/index.js            |  2 +-
 .../selectors/time-series-data.spec.js        | 35 ++++++++++++++++++-
 .../selectors/time-series-selector.spec.js    | 18 ++++++++++
 assets/src/scripts/web-services/models.js     |  4 ++-
 4 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/index.js b/assets/src/scripts/monitoring-location/components/hydrograph/index.js
index cae79c2f4..ada6cc23c 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 5719f63f4..59a745b81 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 7f8866b43..f205208d9 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 4fd318a3f..3fc7ed8f0 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.
-- 
GitLab