testing next/image loader prop is not covered

Viewed 45

I'm building some test units with jest on a NextJS project and I'm aiming to do a 100% coverage for my components tests.

I used this to mock next/image:

jest.mock('next/image', () => ({
  __esModule: true,
  default: () => {
    return 'not found';
  },
}));

I have some images components on my project that have a loader property :

<Image
      loader={() => `/files/images/logoSmall.png`}
      src="https://www.google.com/logos/doodles/2022/montserrat-caballes-89th-birthday-6753651837109386-l.webp"
      width={300}
      height={48}
 />

enter image description here

the problem is my test doesn't cover the loader property and I have no idea what I should change about the mocking part...

0 Answers
Related