diff --git a/src/services/consumption.service.spec.ts b/src/services/consumption.service.spec.ts index 6d57b2bc94d606bf9db975131d354ea09210d3e0..271e2f4d04fcbfee7d8119b2f93012d83448714e 100644 --- a/src/services/consumption.service.spec.ts +++ b/src/services/consumption.service.spec.ts @@ -52,7 +52,18 @@ describe('Consuption service', () => { }, ] describe('getGraphData method', () => { + it('should return null', async () => { + const result = await consumptionDataManager.getGraphData( + mockTimePeriod, + TimeStep.DAY, + [], + mockTimePeriodComparison, + false + ) + expect(result).toBeNull() + }) it('shoud return a mapped data for one fluid', async () => { + console.log(fluidTypes) mockFetchFluidData.mockResolvedValueOnce(mockFetchDataActual) mockFetchFluidData.mockResolvedValueOnce(mockFetchDataComparison) const mockResult = { diff --git a/src/services/consumption.service.ts b/src/services/consumption.service.ts index 22f3c7337969e23a78c668ef6bead16ece083a90..6aaa64512651d1f626846421cce52cc6eaa5d8d6 100644 --- a/src/services/consumption.service.ts +++ b/src/services/consumption.service.ts @@ -56,7 +56,6 @@ export default class ConsumptionDataManager { fluidTypes[0], compareTimePeriod ) - // formatting data const formattedData = this.formatGraphDataManage( fetchedData, @@ -69,6 +68,7 @@ export default class ConsumptionDataManager { // mapping result to contract mappedData = formattedData + return mappedData } else if (fluidTypes.length > 1 || isHome) { const toBeAgreggatedData: ISingleFluidChartData[] = [] for (const fluidType of fluidTypes) {