node/test/parallel/test-async-wrap-trigger-id.js
MaleDong ee31c28298
test: remove string literals for strictEquals/notStrictEquals
In short: Some unit tests are using string literals to simply tell you a
conclusion what's right/wrong BUT not tell you what actually values are.
So it's necessary to print them out in the console.

Refs: https://github.com/nodejs/node/pull/22849
PR-URL: https://github.com/nodejs/node/pull/22891
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-09-22 15:53:20 +02:00

29 lines
756 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
const triggerAsyncId = async_hooks.triggerAsyncId;
const triggerAsyncId0 = triggerAsyncId();
let triggerAsyncId1;
process.nextTick(() => {
process.nextTick(() => {
triggerAsyncId1 = triggerAsyncId();
// Async resources having different causal ancestry
// should have different triggerAsyncIds
assert.notStrictEqual(
triggerAsyncId0,
triggerAsyncId1);
});
process.nextTick(() => {
const triggerAsyncId2 = triggerAsyncId();
// Async resources having the same causal ancestry
// should have the same triggerAsyncId
assert.strictEqual(
triggerAsyncId1,
triggerAsyncId2);
});
});