diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js index dab1eaf852ebfca596794d5c82d8e3826a9297d4..c2198c19f75640c7deb01e91af31734806b731b6 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.js @@ -283,4 +283,3 @@ const getYTickDetails = memoize(tickKind => createSelector( export const getSecondaryYAxisTickDetails = getYTickDetails('secondary'); export const getPrimaryYAxisTickDetails = getYTickDetails('primary'); - diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.test.js b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.test.js index fbd2030b48f4842b13dd37becf3582b0b9eb5ad2..f48ce35757461e38a064358490be07b6e8c59555 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.test.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/selectors/domain.test.js @@ -6,7 +6,8 @@ import { } from '../mock-hydrograph-state'; import { extendDomain, - getYTickDetails, + getPrimaryYAxisTickDetails, + getSecondaryYAxisTickDetails, getFullArrayOfAdditionalTickMarks, getLowestAbsoluteValueOfTickValues, getRoundedTickValues, @@ -64,16 +65,32 @@ describe('monitoring-location/components/hydrograph/selectors/domain module', () }); }); - describe('getYTickDetails', () => { + describe('getPrimaryYAxisTickDetails', () => { it('Returns the default tick details if no parameter is defined', () => { - const tickDetails = getYTickDetails.resultFunc([0, 1], null); + const tickDetails = getPrimaryYAxisTickDetails.resultFunc([0, 1], null); expect(tickDetails.tickValues).toEqual(expect.any(Array)); expect(tickDetails.tickFormat).toEqual(expect.any(Function)); expect(tickDetails.tickFormat(1)).toEqual(expect.any(String)); }); it('returns ticks and a formatting function', () => { - const tickDetails = getYTickDetails.resultFunc([0, 1], {parameterCode: '00065'}); + const tickDetails = getPrimaryYAxisTickDetails.resultFunc([0, 1], {parameterCode: '00065'}); + expect(tickDetails.tickValues).toEqual(expect.any(Array)); + expect(tickDetails.tickFormat).toEqual(expect.any(Function)); + expect(tickDetails.tickFormat(1)).toEqual(expect.any(String)); + }); + }); + + describe('getSecondaryYAxisTickDetails', () => { + it('Returns the default tick details if no parameter is defined', () => { + const tickDetails = getSecondaryYAxisTickDetails.resultFunc([0, 1], null, [0, 1], null); + expect(tickDetails.tickValues).toEqual(expect.any(Array)); + expect(tickDetails.tickFormat).toEqual(expect.any(Function)); + expect(tickDetails.tickFormat(1)).toEqual(expect.any(String)); + }); + + it('returns ticks and a formatting function', () => { + const tickDetails = getSecondaryYAxisTickDetails.resultFunc([0, 1], null, [0, 1], {parameterCode: '00065'}); expect(tickDetails.tickValues).toEqual(expect.any(Array)); expect(tickDetails.tickFormat).toEqual(expect.any(Function)); expect(tickDetails.tickFormat(1)).toEqual(expect.any(String));