<commit_before>import Backburner from "backburner";

var originalDateValueOf = Date.prototype.valueOf;

module("setTimeout",{
  teardown: function(){
    Date.prototype.valueOf = originalDateValueOf;
  }
});

test("setTimeout", function() {
  expect(6);

  var bb = new Backburner(['one']),
      step = 0,
      instance;

  // Force +new Date to return the same result while scheduling
  // run.later timers. Otherwise: non-determinism!
  var now = +new Date();
  Date.prototype.valueOf = function() { return now; };

  stop();
  bb.setTimeout(null, function() {
    start();
    instance = bb.currentInstance;
    equal(step++, 0);
  }, 10);

  bb.setTimeout(null, function() {
    equal(step++, 1);
    equal(instance, bb.currentInstance, "same instance");
  }, 10);

  Date.prototype.valueOf = originalDateValueOf;

  stop();
  setTimeout(function() {
    start();
    equal(step++, 2);

    stop();
    bb.setTimeout(null, function() {
      start();
      equal(step++, 3);
      ok(true, "Another later will execute correctly");
    }, 1);
  }, 20);
});

var bb;
module("setTimeout arguments / arity", {
  setup: function(){
    bb = new Backburner(['one']);
  },
  teardown: function(){
    bb = undefined;
  }
})

test("[callback]", function(){
  expect(2);
   stop();
   bb.setTimeout(function() {
     start();
     equal(arguments.length, 0);
     ok(true, 'was called');
   });<commit_msg>make jshint happy<commit_after>import Backburner from "backburner";

var originalDateValueOf = Date.prototype.valueOf;

module("setTimeout",{
  teardown: function(){
    Date.prototype.valueOf = originalDateValueOf;
  }
});

test("setTimeout", function() {
  expect(6);

  var bb = new Backburner(['one']),
      step = 0,
      instance;

  // Force +new Date to return the same result while scheduling
  // run.later timers. Otherwise: non-determinism!
  var now = +new Date();
  Date.prototype.valueOf = function() { return now; };

  stop();
  bb.setTimeout(null, function() {
    start();
    instance = bb.currentInstance;
    equal(step++, 0);
  }, 10);

  bb.setTimeout(null, function() {
    equal(step++, 1);
    equal(instance, bb.currentInstance, "same instance");
  }, 10);

  Date.prototype.valueOf = originalDateValueOf;

  stop();
  setTimeout(function() {
    start();
    equal(step++, 2);

    stop();
    bb.setTimeout(null, function() {
      start();
      equal(step++, 3);
      ok(true, "Another later will execute correctly");
    }, 1);
  }, 20);
});

var bb;
module("setTimeout arguments / arity", {
  setup: function(){
    bb = new Backburner(['one']);
  },
  teardown: function(){
    bb = undefined;
  }
});

test("[callback]", function(){
  expect(2);
   stop();
   bb.setTimeout(function() {
     start();
     equal(arguments.length, 0);
     ok(true, 'was called');
   });
{'fraction_non_alphanumeric': 0.17324795446460334, 'fraction_numerical': 0.010672358591248666, 'mean_word_length': 3.306278713629403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4638215', 'n_tokens_mistral': 963, 'n_tokens_neox': 890, 'n_words': 218}