Skip to content
Snippets Groups Projects
Commit 009a50b0 authored by Briggs, Aaron Shane's avatar Briggs, Aaron Shane
Browse files

tests download-data

parent e60edd4b
No related branches found
No related tags found
1 merge request!372WDFN-734 Plot Secondary Time Series - add data retrieve option
......@@ -2,14 +2,15 @@
import config from 'ui/config';
import {configureStore} from 'ml/store';
import {setCompareDataVisibility, setMedianDataVisibility} from 'ml/store/hydrograph-state';
import {setCompareDataVisibility, setMedianDataVisibility, setSecondaryIVDataVisibility} from 'ml/store/hydrograph-state';
import {
TEST_CURRENT_TIME_RANGE,
TEST_COMPARE_TIME_RANGE,
TEST_PRIMARY_IV_DATA,
TEST_STATS_DATA,
TEST_GW_LEVELS
TEST_GW_LEVELS,
TEST_SECONDARY_IV_DATA
} from '../mock-hydrograph-state';
import {mount} from '@vue/test-utils';
......@@ -31,6 +32,7 @@ describe('monitoring-location/components/hydrograph/vue-components/download-data
currentTimeRange: TEST_CURRENT_TIME_RANGE,
prioryearTimeRange: TEST_COMPARE_TIME_RANGE,
primaryIVData: TEST_PRIMARY_IV_DATA,
secondaryIVData: TEST_SECONDARY_IV_DATA,
compareIVData: TEST_PRIMARY_IV_DATA,
statisticsData: TEST_STATS_DATA
},
......@@ -40,7 +42,9 @@ describe('monitoring-location/components/hydrograph/vue-components/download-data
hydrographState: {
showCompareIVData: false,
showMedianData: false,
showSecondaryIVData: false,
selectedIVMethodID: '90649',
selectedSecondaryIVMethodID: '57465',
selectedParameterCode: '72019'
}
};
......@@ -86,6 +90,8 @@ describe('monitoring-location/components/hydrograph/vue-components/download-data
expect(wrapper.findAll('input[type="radio"]')).toHaveLength(4);
await store.dispatch(setMedianDataVisibility(true));
expect(wrapper.findAll('input[type="radio"]')).toHaveLength(5);
await store.dispatch(setSecondaryIVDataVisibility(true));
expect(wrapper.findAll('input[type="radio"]')).toHaveLength(6);
});
it('Shows an error message if the download button is clicked with no radio buttons checked', async() => {
......@@ -149,6 +155,20 @@ describe('monitoring-location/components/hydrograph/vue-components/download-data
expect(windowSpy.mock.calls[0][0]).toContain('endDT=2013-06-13T15:57:44.000-05:00');
});
it('Opens window for secondary parameter data when selected and downloaded', async() => {
const downloadButton = wrapper.find('button.download-selected-data');
await store.dispatch(setSecondaryIVDataVisibility(true));
const compareDataButton = wrapper.find('#test-buttons-secondary-data-download-button');
await compareDataButton.trigger('click');
await downloadButton.trigger('click');
expect(windowSpy.mock.calls[0][0]).toContain('/iv/');
expect(windowSpy.mock.calls[0][0]).toContain('sites=11112222');
expect(windowSpy.mock.calls[0][0]).toContain('parameterCd=00065&');
expect(windowSpy.mock.calls[0][0]).toContain('startDT=2020-02-24T10:15:00.000-06:00');
expect(windowSpy.mock.calls[0][0]).toContain('endDT=2020-09-20T11:45:00.000-05:00');
});
it('Expects the error alert to disappear once a user selects a radio', async() => {
const downloadButton = wrapper.find('button.download-selected-data');
await downloadButton.trigger('click');
......
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