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

fix tests

parent b7a5badc
No related branches found
No related tags found
4 merge requests!1154feat: GRDF consent email,!1138chore: remove unused error from useKonnectorAuth,!1137feat(grdf)!: update error messages,!1132refactor: remove unused chart.loading
import { render, screen } from '@testing-library/react'
import { render, screen, waitFor } from '@testing-library/react'
import { FluidState, FluidType, TimeStep } from 'enums'
import React from 'react'
import { Provider } from 'react-redux'
......@@ -122,7 +122,7 @@ describe('ConsumptionView component', () => {
).toBeTruthy()
})
it('should render mutlifluid consumption if at least one fluid is connected', () => {
it('should render mutlifluid consumption if at least one fluid is connected without konnectorViewerCard', async () => {
const store = createMockEcolyoStore({
chart: mockChartStateShowOffline,
global: {
......@@ -136,12 +136,16 @@ describe('ConsumptionView component', () => {
<ConsumptionView fluidType={FluidType.MULTIFLUID} />
</Provider>
)
await waitFor(() => null, { container })
expect(
container.getElementsByClassName('consumptionview-content')[0]
container.getElementsByTagName('mock-consumptionDetails').item(0)
).toBeInTheDocument()
expect(
container.getElementsByTagName('mock-konnectorViewerCard').item(0)
).not.toBeInTheDocument()
})
it('should render Electricity when elec is connected', () => {
it('should render Electricity when elec is connected with konnectorViewCard', async () => {
const store = createMockEcolyoStore({
chart: mockChartStateShowOffline,
global: {
......@@ -155,11 +159,12 @@ describe('ConsumptionView component', () => {
<ConsumptionView fluidType={FluidType.ELECTRICITY} />
</Provider>
)
await waitFor(() => null, { container })
expect(
container.getElementsByClassName('consumptionview-content').item(0)
container.getElementsByTagName('mock-consumptionDetails').item(0)
).toBeInTheDocument()
expect(
container.getElementsByTagName('mock-consumptionDetails').item(0)
container.getElementsByTagName('mock-konnectorViewerCard').item(0)
).toBeInTheDocument()
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment