Tweak times of async unit tests.

Former-commit-id: 064813c739edde5f6236f33a3c75a6cb39ba774e
This commit is contained in:
John-David Dalton
2012-10-30 23:49:23 -07:00
parent c6093c084c
commit 39fb05033f

View File

@@ -295,17 +295,17 @@
(function() { (function() {
asyncTest('subsequent debounced calls return the last `func` result', function() { asyncTest('subsequent debounced calls return the last `func` result', function() {
var debounced = _.debounce(function(value) { return value; }, 100); var debounced = _.debounce(function(value) { return value; }, 90);
debounced('x'); debounced('x');
setTimeout(function() { setTimeout(function() {
equal(debounced('y'), 'x'); equal(debounced('y'), 'x');
QUnit.start(); QUnit.start();
}, 220); }, 120);
}); });
test('subsequent "immediate" debounced calls return the last `func` result', function() { test('subsequent "immediate" debounced calls return the last `func` result', function() {
var debounced = _.debounce(function(value) { return value; }, 100, true), var debounced = _.debounce(function(value) { return value; }, 90, true),
result = [debounced('x'), debounced('y')]; result = [debounced('x'), debounced('y')];
deepEqual(result, ['x', 'x']); deepEqual(result, ['x', 'x']);
@@ -1626,7 +1626,7 @@
(function() { (function() {
test('subsequent calls should return the result of the first call', function() { test('subsequent calls should return the result of the first call', function() {
var throttled = _.throttle(function(value) { return value; }, 100), var throttled = _.throttle(function(value) { return value; }, 90),
result = [throttled('x'), throttled('y')]; result = [throttled('x'), throttled('y')];
deepEqual(result, ['x', 'x']); deepEqual(result, ['x', 'x']);
@@ -1634,9 +1634,9 @@
test('supports calls in a loop', function() { test('supports calls in a loop', function() {
var counter = 0, var counter = 0,
throttled = _.throttle(function() { counter++; }, 100), throttled = _.throttle(function() { counter++; }, 90),
start = new Date, start = new Date,
limit = 220; limit = 180;
while ((new Date - start) < limit) { while ((new Date - start) < limit) {
throttled(); throttled();
@@ -1651,12 +1651,12 @@
if (counter < 4) { if (counter < 4) {
throttled(); throttled();
} }
}, 100); }, 90);
setTimeout(function() { setTimeout(function() {
ok(counter > 1); ok(counter > 1);
QUnit.start(); QUnit.start();
}, 220); }, 180);
throttled(); throttled();
}); });
@@ -1667,12 +1667,12 @@
var throttled = _.throttle(function() { var throttled = _.throttle(function() {
times.push(new Date - now); times.push(new Date - now);
}, 40); }, 32);
setTimeout(throttled, 40); setTimeout(throttled, 32);
setTimeout(throttled, 40); setTimeout(throttled, 32);
setTimeout(throttled, 80); setTimeout(throttled, 64);
setTimeout(throttled, 80); setTimeout(throttled, 64);
setTimeout(function() { setTimeout(function() {
var actual = _.every(times, function(value, index) { var actual = _.every(times, function(value, index) {