How to use the p-map.mockRejectedValueOnce function in p-map

To help you get started, we’ve selected a few p-map 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 okonet / lint-staged / test / resolveTaskFn-chunked.spec.js View on Github external
it('should handle unexpected error', async () => {
      expect.assertions(1)
      pMap.mockRejectedValueOnce(new Error('Unexpected Error'))

      const taskFn = resolveTaskFn({ ...defaultOpts })
      try {
        await taskFn()
      } catch (err) {
        expect(err.message).toMatch(dedent`
          ${logSymbols.error} test got an unexpected error.
          Unexpected Error
        `)
      }
    })
  })

p-map

Map over promises concurrently

MIT
Latest version published 8 months ago

Package Health Score

78 / 100
Full package analysis