Skip to content

Commit

Permalink
Merge pull request jashkenas#519 from mark-rushakoff/test-cleanup
Browse files Browse the repository at this point in the history
Prefer equal(x, y) over ok(x == y)
  • Loading branch information
braddunbar committed Mar 23, 2012
2 parents ebb9db4 + 8567229 commit c46cd35
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/functions.js
Expand Up @@ -101,8 +101,8 @@ $(document).ready(function() {
setTimeout(throttledIncr, 190);
setTimeout(throttledIncr, 220);
setTimeout(throttledIncr, 240);
_.delay(function(){ ok(counter == 1, "incr was called immediately"); }, 30);
_.delay(function(){ ok(counter == 4, "incr was throttled"); start(); }, 400);
_.delay(function(){ equal(counter, 1, "incr was called immediately"); }, 30);
_.delay(function(){ equal(counter, 4, "incr was throttled"); start(); }, 400);
});

asyncTest("functions: throttle arguments", 2, function() {
Expand All @@ -122,15 +122,15 @@ $(document).ready(function() {
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100);
throttledIncr();
_.delay(function(){ ok(counter == 1, "incr was called once"); start(); }, 220);
_.delay(function(){ equal(counter, 1, "incr was called once"); start(); }, 220);
});

asyncTest("functions: throttle twice", 1, function() {
var counter = 0;
var incr = function(){ counter++; };
var throttledIncr = _.throttle(incr, 100);
throttledIncr(); throttledIncr();
_.delay(function(){ ok(counter == 2, "incr was called twice"); start(); }, 220);
_.delay(function(){ equal(counter, 2, "incr was called twice"); start(); }, 220);
});

asyncTest("functions: debounce", 1, function() {
Expand All @@ -143,7 +143,7 @@ $(document).ready(function() {
setTimeout(debouncedIncr, 90);
setTimeout(debouncedIncr, 120);
setTimeout(debouncedIncr, 150);
_.delay(function(){ ok(counter == 1, "incr was debounced"); start(); }, 220);
_.delay(function(){ equal(counter, 1, "incr was debounced"); start(); }, 220);
});

asyncTest("functions: debounce asap", 2, function() {
Expand Down

0 comments on commit c46cd35

Please sign in to comment.