1
0
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:
Krishna Acondy
2021-03-31 08:32:42 +01:00
parent a8ca534b0b
commit c0d27fa254
16 changed files with 472 additions and 298 deletions

View 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])
})
})