Sha256: f1ad2268cf0769528ed2bdc93894bcd3d6a93a25a0557252102d66b6996f6f21

Contents?: true

Size: 864 Bytes

Versions: 5

Compression:

Stored size: 864 Bytes

Contents

'use strict';
require('../common');
const assert = require('assert');
const active = require('timers').active;

// active() should create timers for these
var legitTimers = [
  { _idleTimeout: 0 },
  { _idleTimeout: 1 }
];

legitTimers.forEach(function(legit) {
  const savedTimeout = legit._idleTimeout;
  active(legit);
  // active() should mutate these objects
  assert.strictEqual(legit._idleTimeout, savedTimeout);
  assert(Number.isInteger(legit._idleStart));
  assert(legit._idleNext);
  assert(legit._idlePrev);
});


// active() should not create a timer for these
var bogusTimers = [
  { _idleTimeout: -1 },
  { _idleTimeout: undefined },
];

bogusTimers.forEach(function(bogus) {
  const savedTimeout = bogus._idleTimeout;
  active(bogus);
  // active() should not mutate these objects
  assert.deepStrictEqual(bogus, {_idleTimeout: savedTimeout});
});

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/test/parallel/test-timers-active.js
node-compiler-0.9.0 vendor/node-v7.2.1/test/parallel/test-timers-active.js
node-compiler-0.8.0 vendor/node-v7.2.0/test/parallel/test-timers-active.js
node-compiler-0.7.0 vendor/node-v6.9.1/test/parallel/test-timers-active.js
node-compiler-0.7.0 vendor/node-v7.1.0/test/parallel/test-timers-active.js