Skip to content

Commit

Permalink
test: Fixed flakey when versioned test (newrelic#2821)
Browse files Browse the repository at this point in the history
  • Loading branch information
bizob2828 authored Dec 9, 2024
1 parent a679872 commit 54f034b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/versioned/when/when.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ test('Promise#delay', async (t) => {
})

test('Promise#timeout', async (t) => {
const plan = tspl(t, { plan: 12 })
const plan = tspl(t, { plan: 10 })
const { agent, when } = setupTest(t)
const { Promise } = when
const testFunc = (name) => {
Expand All @@ -681,8 +681,8 @@ test('Promise#timeout', async (t) => {
.catch((error) => {
const end = Date.now()
plan.equal(error.message, `${name} timeout message`, `${name} should have correct message`)
plan.ok(end - start > 48, `${name} should wait close to the correct time`)
plan.ok(end - start < 75, `${name} should wait close to the correct time`)
const time = end - start
plan.ok(time > 48, `${name} should wait close to the correct time, actual wait ${time}`)
})
}

Expand Down Expand Up @@ -948,7 +948,7 @@ async function testThrowOutsideTransaction({ plan, agent, testFunc }) {
plan.equal(agent.getTransaction(), undefined, `${name} has no transaction`)
},
function rejected(error) {
assert.ifError(error, `${name} should not result in error`)
plan.ok(!error, `${name} should not result in error`)
}
)
isAsync = true
Expand Down Expand Up @@ -979,7 +979,7 @@ async function testInsideTransaction({ plan, agent, testFunc }) {
plan.equal(agent.getTransaction(), tx, `${name} has the right transaction`)
},
function rejected(error) {
plan.ifError(error, `${name} should not result in error`)
plan.ok(!error, `${name} should not result in error`)
}
)
isAsync = true
Expand Down

0 comments on commit 54f034b

Please sign in to comment.