Skip to content

@wycats /async.js secret

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
test("something", function() {
expect(1);
stop();
setTimeout(function() {
start();
ok(true);
}, 1000);
});
// must() returns a function that MUST be called (simple impl: stop() and
// wrap the function with a start())
test("something", function() {
setTimeout(must(function() {
ok(true);
}), 1000)
Ember.something(mustNot);
})
// the basic idea is that often you use expect() simply to assert that some
// function is actually called (or not called).
must = function(callback) {
stop();
return function() {
start();
callback.apply(this, arguments);
}
};
mustNot = function() {
return function() {
ok(false, "WAT");
}
};
// this is for cases where you basically need a function that throws...
// perhaps there could be some async version with a timeout?
mustNot = function(timeout) {
// incorrect implementation
stop();
var f = function() {
ok(false, "WAT");
};
var timer = setTimeout(f, timeout);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.