mirror of
https://github.com/sasjs/lint.git
synced 2026-01-10 05:50:05 +00:00
chore(*): split lint module into smaller submodules, added tests
This commit is contained in:
15
src/utils/asyncForEach.spec.ts
Normal file
15
src/utils/asyncForEach.spec.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { asyncForEach } from './asyncForEach'
|
||||
|
||||
describe('asyncForEach', () => {
|
||||
it('should execute the async callback for each item in the given array', async () => {
|
||||
const callback = jest.fn().mockImplementation(() => Promise.resolve())
|
||||
const array = [1, 2, 3]
|
||||
|
||||
await asyncForEach(array, callback)
|
||||
|
||||
expect(callback.mock.calls.length).toEqual(3)
|
||||
expect(callback.mock.calls[0]).toEqual([1, 0, array])
|
||||
expect(callback.mock.calls[1]).toEqual([2, 1, array])
|
||||
expect(callback.mock.calls[2]).toEqual([3, 2, array])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user