operations
Version:
A library for managing complex chains of asynchronous operations in Javascript.
37 lines (29 loc) • 858 B
JavaScript
/*global describe,it,beforeEach */
var Operation, _, assert;
if (typeof require == 'undefined') {
Operation = op.Operation;
assert = chai.assert;
_ = getUnderscore(); // Shim.
}
else { // NodeJS
assert = require('chai').assert;
Operation = require('../src/operation').Operation;
_ = require('underscore');
}
describe('registration', function () {
describe('of operations', function () {
it('xyz', function (done) {
var op = new Operation(function (done) {
setTimeout(function () {
done();
}, 50);
});
op.completion = function () {
assert.notInclude(Operation.running, op);
done();
};
op.start();
assert.include(Operation.running, op);
});
});
});