How to use the p-map.mockResolvedValue 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
describe('chunked tasks', () => {
    afterEach(() => {
      execa.mockClear()
      pMap.mockClear()
    })

    pMap.mockResolvedValue([
      {
        stdout: 'a-ok',
        stderr: '',
        code: 0,
        failed: false,
        cmd: 'mock cmd'
      }
    ])

    it('should invoke execa in mapper function', async () => {
      expect.assertions(3)

      const taskFn = resolveTaskFn({ ...defaultOpts })
      await taskFn()
      const [[[chunk], mapper]] = pMap.mock.calls
      expect(pMap).toHaveBeenCalledWith([['test.js']], mapper, { concurrency: 1 })

p-map

Map over promises concurrently

MIT
Latest version published 8 months ago

Package Health Score

78 / 100
Full package analysis