I have this component and it is using swiper/react. While writing test cases, I'm not able to mock the swiper event it is getting in the onSlideChange. I'm not able to pass through the if condition in the onSlideChangeHandler function. Can anybody help? thanks!
import { Swiper, SwiperSlide } from 'swiper/react';
export default function Abcxyz(props: PropsType) {
...
...
const onSlideChangeHandler = (swiper) => {
const activeSlideIndex = swiper.activeIndex;
const slides = swiper.slides;
if (slides[activeSlideIndex]?.id === 'hybrid printer bundle') {
visibleConfigOptionsStore.setVisibleConfigOptions(
slides[activeSlideIndex].id
);
}
};
return (
<Swiper
onSlideChange={(swiper) => onSlideChangeHandler(swiper)}
>
)
}
Tried few things but nothing is working at the moment.