<commit_before>require('tap').mochaGlobals();
var assert = require('assert');


var RealScheduler = require('../src/RealScheduler');



describe('RealScheduler', function() {
    it('1st call returns syntheticTime equals to delay', function(done) {
        var scheduler = new RealScheduler((sch) => {

        sch.stop();
        assert.equal(sch.getSyntheticTimeElapsed(), 100);
        done();
    }, 100);
    });
});

describe('RealScheduler', function() {
    it('1st call (with waitForTheFirstCall option false) returns syntheticTime equals to 0', function(done) {
        var scheduler = new RealScheduler((sch) => {

        sch.stop();
        assert.equal(sch.getSyntheticTimeElapsed(), 0);
        done();
    }, 100, {waitForTheFirstCall: false});
    });
});
<commit_msg>test onStop<commit_after>require('tap').mochaGlobals();
var assert = require('assert');


var RealScheduler = require('../src/RealScheduler');

var isStopCalled;

var onStopHandler = function () {
    isStopCalled = true;
}

beforeEach(function () {
    isStopCalled = false;
});


describe('RealScheduler', function () {
    it('1st call returns syntheticTime equals to delay', function (done) {
        var scheduler = new RealScheduler((sch) => {

            sch.stop();
            assert.equal(sch.getSyntheticTimeElapsed(), 100);
            done();
        }, 100);
    });

    it('1st call (with waitForTheFirstCall option false) returns syntheticTime equals to 0', function (done) {
        var scheduler = new RealScheduler((sch) => {

            sch.stop();
            assert.equal(sch.getSyntheticTimeElapsed(), 0);
            done();
        }, 100, { waitForTheFirstCall: false });
    });

    it('Call onStop handler if defined', function (done) {
        var scheduler = new RealScheduler((sch) => {

            sch.stop();
            assert.equal(isStopCalled, true);
            done();
        }, 100, { onStop: onStopHandler });
    });
});



{'fraction_non_alphanumeric': 0.15030674846625766, 'fraction_numerical': 0.014826175869120654, 'mean_word_length': 2.8523622047244093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '5906814', 'n_tokens_mistral': 606, 'n_tokens_neox': 559, 'n_words': 131}