Skip to content
Snippets Groups Projects
Commit 5f6ed9c0 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

tests

parent 78325bb7
Branches
Tags v2.6.0
1 merge request!923feat(analysis): show analysis with offline konnector
......@@ -581,4 +581,32 @@ describe('Consumption service', () => {
expect(result.length).toEqual(4)
})
})
describe('getFluidsWithDataForTimePeriod', () => {
const allFluids = [FluidType.ELECTRICITY, FluidType.WATER, FluidType.GAS]
const timePeriods: TimePeriod = {
startDate: DateTime.local(2023, 5, 1),
endDate: DateTime.local(2023, 6, 1),
}
it('should return 2 fluids', async () => {
mockFetchFluidData.mockResolvedValueOnce(null)
mockFetchFluidData.mockResolvedValueOnce(mockFetchDataActual)
mockFetchFluidData.mockResolvedValueOnce(mockFetchDataActual)
const fluidsWithData =
await consumptionDataManager.getFluidsWithDataForTimePeriod(
allFluids,
timePeriods
)
expect(fluidsWithData).toEqual([FluidType.WATER, FluidType.GAS])
})
it('should return no fluids', async () => {
mockFetchFluidData.mockResolvedValue(null)
const fluidsWithData =
await consumptionDataManager.getFluidsWithDataForTimePeriod(
allFluids,
timePeriods
)
expect(fluidsWithData).toEqual([])
})
})
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment