mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 13:43:55 +00:00

* use let and const instead of var * use assert.strictEqual instead assert.equal PR-URL: https://github.com/nodejs/node/pull/10396 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
29 lines
795 B
JavaScript
29 lines
795 B
JavaScript
'use strict';
|
|
// test-cluster-worker-constructor.js
|
|
// validates correct behavior of the cluster.Worker constructor
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const cluster = require('cluster');
|
|
let worker;
|
|
|
|
worker = new cluster.Worker();
|
|
assert.strictEqual(worker.suicide, undefined);
|
|
assert.strictEqual(worker.state, 'none');
|
|
assert.strictEqual(worker.id, 0);
|
|
assert.strictEqual(worker.process, undefined);
|
|
|
|
worker = new cluster.Worker({
|
|
id: 3,
|
|
state: 'online',
|
|
process: process
|
|
});
|
|
assert.strictEqual(worker.suicide, undefined);
|
|
assert.strictEqual(worker.state, 'online');
|
|
assert.strictEqual(worker.id, 3);
|
|
assert.strictEqual(worker.process, process);
|
|
|
|
worker = cluster.Worker.call({}, {id: 5});
|
|
assert(worker instanceof cluster.Worker);
|
|
assert.strictEqual(worker.id, 5);
|