setTimeout(function(){ equals( arr.length, 0, 'callback should not be executed' ); start_time = null; arr = []; i = 0; callback ? callback() : start(); }, delay * 2);
setTimeout(function(){ //console.log( arr[0] - done_time ); equals( arr.length, 1, 'callback was executed once' ); ok( arr[0] >= done_time, 'callback should be executed after the finish' ); start_time = null; arr = []; i = 0; callback ? callback() : start(); }, delay * 2);
setTimeout(function(){ //console.log( arr[0] - start_time ); equals( arr.length, 1, 'callback was executed once' ); ok( arr[0] - start_time <= 5, 'callback should be executed at the start' ); start_time = null; arr = []; i = 0; callback ? callback() : start(); }, delay * 2);
setTimeout(function(){ //console.log( arr, arr.length, len, i ); ok( arr.length < i, 'callback should be executed less # of times than throttled-callback' ); equals( arr[0], 0, 'callback should be executed immediately' ); equals( arr.length - len, 1, 'callback should be executed one more time after finish' ); start_time = null; arr = []; i = 0; callback ? callback() : start(); }, delay * 2);
setTimeout(function() { equals(callCount, 0, 'callback should not be called'); start(); }, delay * 2);
var mult = require('./mult').mult; var ld = require('lodash'); import qunit from 'qunitjs'; //document.write(mult(2,3)); //document.write(ld.zip([1,2,3],['a','b','c']).toString()); qunit.test ('my first test', assert => { assert.equal(1,1); }); qunit.test ('my second test', assert => { assert.equal(1,2); }); qunit.start();
const QUnit = require('qunitjs'); const existsStat = require('./'); QUnit.module('existsStat', function() { QUnit.test('returns the stats object for a path that exists', function(assert) { const dirPath = path.join(__dirname, 'fixtures', 'exists-dir'); const filePath = path.join(__dirname, 'fixtures', 'exists-dir', 'exists.js'); assert.ok(existsStat(dirPath).isDirectory()); assert.ok(existsStat(filePath).isFile()); }); QUnit.test('returns null for a path that does not exist', function(assert) { const filePath = path.join(__dirname, 'fixtures', 'does-not-exist.js'); const dirPath = path.join(__dirname, 'fixtures', 'does-not-exist-dir'); assert.strictEqual(existsStat(filePath), null); assert.strictEqual(existsStat(dirPath), null); }); }); QUnit.on('runEnd', function(data) { const testCounts = JSON.stringify(data.testCounts, null, 2); console.log(testCounts); process.exitCode = data.testCounts.failed; }); QUnit.start();
MongoHelper.init(function () { t.start(); });
start: function () { QUnit.start(); }