How to use the gatsby-source-filesystem.createRemoteFileNode.mockImplementationOnce function in gatsby-source-filesystem

To help you get started, we’ve selected a few gatsby-source-filesystem examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angeloashmore / gatsby-source-prismic / src / __tests__ / node / normalizers.js View on Github external
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()
  })

gatsby-source-filesystem

Gatsby source plugin for building websites from local data. Markdown, JSON, images, YAML, CSV, and dozens of other data types supported.

MIT
Latest version published 6 months ago

Package Health Score

85 / 100
Full package analysis