Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Deyan Totev committed Nov 18, 2023
1 parent c543f05 commit 1ab0121
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions source/_internals/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,3 +335,7 @@ export const FOOBAR = 'FOOBAR'
export function eq(actual, expected){
expect(actual).toEqual(expected)
}

export const willFailAssertion = () => {
expect(true).toBe(false)
}
8 changes: 5 additions & 3 deletions source/mapParallelAsync.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { willFailAssertion } from './_internals/testUtils.js'
import { composeAsync } from './composeAsync.js'
import { delay } from './delay.js'
import { map } from './map.js'
Expand Down Expand Up @@ -32,12 +33,13 @@ test('composeAsync', async () => {

test('error', async () => {
try {
const fn = async x => {
const fn = async () => {
JSON.parse('{:')
}
const result = await mapParallelAsync(fn, [ 1, 2, 3 ])
await mapParallelAsync(fn, [ 1, 2, 3 ])
willFailAssertion()
} catch (err){
expect(err.message).toBe('Unexpected token : in JSON at position 1')
expect(err.message).toBe(`Expected property name or '}' in JSON at position 1`)
}
})

Expand Down

0 comments on commit 1ab0121

Please sign in to comment.