Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('localFile field is empty if file node could not be created and shouldDownloadImage is true', async () => {
createRemoteFileNode.mockImplementationOnce(async () => {
throw new Error()
})
const result = await normalizeImageField(undefined, value, undefined, {
...contextWithDownloadedImages,
gatsbyContext: {
...contextWithDownloadedImages.gatsbyContext,
reporter: {
...contextWithDownloadedImages.gatsbyContext.reporter,
error: () => {},
},
},
})
expect(result.localFile).toBeUndefined()
})