Welcome to the Linux Foundation Forum!

Unit Tests - Assertions

Hello,

At the very end of the Assertions sections, there is this code;

const pseudoReq = async (url) => {
  await timeout(300)
  if (url === 'http://error.com') throw Error('network error')
  return Buffer.from('some data')
}
assert.doesNotReject(pseudoReq('http://example.com'))
assert.rejects(pseudoReq('http://error.com'), Error('network error'))

I think the second line from last is erroneous.

Can you confirm if that is the case?

Comments

Categories

Upcoming Training