0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-domain-enter-exit.js
Rich Trott a7335bd1f0 test,benchmark: use deepStrictEqual()
In preparation for a lint rule that will enforce
assert.deepStrictEqual() over assert.deepEqual(), change tests and
benchmarks accordingly. For tests and benchmarks that are testing or
benchmarking assert.deepEqual() itself, apply a comment to ignore the
upcoming rule.

PR-URL: https://github.com/nodejs/node/pull/6213
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-22 14:38:09 -07:00

40 lines
1012 B
JavaScript

'use strict';
// Make sure the domain stack is a stack
require('../common');
var assert = require('assert');
var domain = require('domain');
function names(array) {
return array.map(function(d) {
return d.name;
}).join(', ');
}
var a = domain.create();
a.name = 'a';
var b = domain.create();
b.name = 'b';
var c = domain.create();
c.name = 'c';
a.enter(); // push
assert.deepStrictEqual(domain._stack, [a],
'a not pushed: ' + names(domain._stack));
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
'b not pushed: ' + names(domain._stack));
c.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b, c],
'c not pushed: ' + names(domain._stack));
b.exit(); // pop
assert.deepStrictEqual(domain._stack, [a],
'b and c not popped: ' + names(domain._stack));
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b],
'b not pushed: ' + names(domain._stack));