In our tests, we had several snapshots that included content wrapped in next/head. We had previously followed the below pattern for the mock, which allowed us to see all the header tags like meta, link, title, etc in the snapshot for the component being tested.
jest.mock('next/head', () => {
return {
__esModule: true,
default: ({ children }: { children: Array<ReactElement> }) => {
return children
}
}
})
However, after upgrading, we see these tests fail and all the header-specific fields like meta, link, etc are all absent from the component fragment. We were testing the snapshot like the below.
const { container } = render()
expect(container).toMatchSnapshot()
No matter how we update the mock, we're unable to get the header tags to appear in the component fragment snapshot.