1- import CalendarComponent from "./CalendarComponent" ;
2- import { fireEvent , render , screen } from "@testing-library/react" ;
3- import React from "react" ;
4- import { BrowserRouter } from "react-router-dom" ;
5- import { I18nextProvider } from "react-i18next" ;
1+ import { fireEvent , render , screen } from "@testing-library/react" ;
62import i18n from "i18next" ;
7- import { useBodyWeightQuery } from "../../BodyWeight/queries" ;
8- import { useMeasurementsCategoryQuery } from "../../Measurements/queries" ;
9- import { MeasurementCategory } from "../../Measurements/models/Category" ;
10- import { MeasurementEntry } from "../../Measurements/models/Entry" ;
11- import { WeightEntry } from "../../BodyWeight/model" ;
3+ import React from "react" ;
4+ import { I18nextProvider } from "react-i18next" ;
5+ import { BrowserRouter } from "react-router-dom" ;
6+ import { WeightEntry } from "../../BodyWeight/model" ;
7+ import { useBodyWeightQuery } from "../../BodyWeight/queries" ;
8+ import { MeasurementCategory } from "../../Measurements/models/Category" ;
9+ import { MeasurementEntry } from "../../Measurements/models/Entry" ;
10+ import { useMeasurementsCategoryQuery } from "../../Measurements/queries" ;
11+ import CalendarComponent from "./CalendarComponent" ;
1212
1313jest . mock ( '../../BodyWeight/queries' , ( ) => ( {
1414 useBodyWeightQuery : jest . fn ( ) ,
@@ -58,7 +58,7 @@ describe('CalendarComponent', () => {
5858
5959 const getDaysInMonth = ( year : number , month : number ) => {
6060 return new Date ( year , month + 1 , 0 ) . getDate ( ) ;
61- }
61+ } ;
6262
6363 test ( "renders calendar with days and header" , ( ) => {
6464 renderComponent ( ) ;
@@ -96,16 +96,14 @@ describe('CalendarComponent', () => {
9696
9797 const tenthDay = screen . getByText ( '10' ) ;
9898 fireEvent . click ( tenthDay ) ;
99-
100- expect ( screen . getByText ( 'Body fat: 20 %' ) ) . toBeInTheDocument ( ) ;
99+ expect ( screen . getByText ( / b o d y f a t : 2 0 % / i) ) . toBeInTheDocument ( ) ;
101100 } ) ;
102101
103102 test ( 'displays weight details for selected day' , ( ) => {
104103 renderComponent ( ) ;
105104
106105 const fifthDay = screen . getByText ( '5' ) ;
107106 fireEvent . click ( fifthDay ) ;
108-
109- expect ( screen . getByText ( 'Weight: 70 kg' ) ) . toBeInTheDocument ( ) ;
107+ expect ( screen . getByText ( '70.0 kg' ) ) . toBeInTheDocument ( ) ;
110108 } ) ;
111109} ) ;
0 commit comments