diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-05-26 17:53:06 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-03 23:08:24 +0200 |
commit | 1dc3272bb9c2ecd442efd5b978a852a7da31c1e9 (patch) | |
tree | d835fa61e0503a8b5c4405c03003085129c2d0fe /test/async-hooks/test-enable-disable.js | |
parent | 8741e3c7501cbe66696bd3fad4a0a923e76ba11d (diff) | |
download | android-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.tar.gz android-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.tar.bz2 android-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.zip |
test: improve async hooks test error messages
Improve error messages in the async hooks tests, mostly by removing
unhelpful `message` parameters for assertions.
PR-URL: https://github.com/nodejs/node/pull/13243
Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/async-hooks/test-enable-disable.js')
-rw-r--r-- | test/async-hooks/test-enable-disable.js | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/test/async-hooks/test-enable-disable.js b/test/async-hooks/test-enable-disable.js index 555baf3fcf..cc93750c88 100644 --- a/test/async-hooks/test-enable-disable.js +++ b/test/async-hooks/test-enable-disable.js @@ -145,22 +145,17 @@ function onfirstImmediate() { const as1 = hook1.activitiesOfTypes(types); const as2 = hook2.activitiesOfTypes(types); const as3 = hook3.activitiesOfTypes(types); - assert.strictEqual(as1.length, 1, - 'hook1 captured one immediate on first callback'); + assert.strictEqual(as1.length, 1); // hook2 was not enabled yet .. it is enabled after hook3's "before" completed - assert.strictEqual(as2.length, 0, - 'hook2 captured no immediate on first callback'); - assert.strictEqual(as3.length, 1, - 'hook3 captured one immediate on first callback'); + assert.strictEqual(as2.length, 0); + assert.strictEqual(as3.length, 1); // Check that hook1 and hook3 captured the same Immediate and that it is valid const firstImmediate = as1[0]; - assert.strictEqual(as3[0].uid, as1[0].uid, - 'hook1 and hook3 captured same first immediate'); - assert.strictEqual(firstImmediate.type, 'Immediate', 'immediate'); - assert.strictEqual(typeof firstImmediate.uid, 'number', 'uid is a number'); - assert.strictEqual(typeof firstImmediate.triggerId, - 'number', 'triggerId is a number'); + assert.strictEqual(as3[0].uid, as1[0].uid); + assert.strictEqual(firstImmediate.type, 'Immediate'); + assert.strictEqual(typeof firstImmediate.uid, 'number'); + assert.strictEqual(typeof firstImmediate.triggerId, 'number'); checkInvocations(as1[0], { init: 1, before: 1 }, 'hook1[0]: on first immediate'); checkInvocations(as3[0], { init: 1, before: 1 }, @@ -187,15 +182,9 @@ function onsecondImmediate() { const as1 = hook1.activitiesOfTypes(types); const as2 = hook2.activitiesOfTypes(types); const as3 = hook3.activitiesOfTypes(types); - assert.strictEqual( - as1.length, 2, - 'hook1 captured first and second immediate on second callback'); - assert.strictEqual( - as2.length, 2, - 'hook2 captured first and second immediate on second callback'); - assert.strictEqual( - as3.length, 2, - 'hook3 captured first and second immediate on second callback'); + assert.strictEqual(as1.length, 2); + assert.strictEqual(as2.length, 2); + assert.strictEqual(as3.length, 2); // Assign the info collected by each hook for each immediate for easier // reference. @@ -210,14 +199,11 @@ function onsecondImmediate() { // Check that all hooks captured the same Immediate and that it is valid const secondImmediate = hook1Second; - assert.strictEqual(hook2Second.uid, hook3Second.uid, - 'hook2 and hook3 captured same second immediate'); - assert.strictEqual(hook1Second.uid, hook3Second.uid, - 'hook1 and hook3 captured same second immediate'); - assert.strictEqual(secondImmediate.type, 'Immediate', 'immediate'); - assert.strictEqual(typeof secondImmediate.uid, 'number', 'uid is a number'); - assert.strictEqual(typeof secondImmediate.triggerId, 'number', - 'triggerId is a number'); + assert.strictEqual(hook2Second.uid, hook3Second.uid); + assert.strictEqual(hook1Second.uid, hook3Second.uid); + assert.strictEqual(secondImmediate.type, 'Immediate'); + assert.strictEqual(typeof secondImmediate.uid, 'number'); + assert.strictEqual(typeof secondImmediate.triggerId, 'number'); checkInvocations(hook1First, { init: 1, before: 1, after: 1, destroy: 1 }, 'hook1First: on second immediate'); |