taskbuffer/test/test.js
2016-05-04 04:28:50 +02:00

27 lines
3.4 KiB
JavaScript

/// <reference path="../ts/typings/main.d.ts" />
var taskbuffer = require("../dist/index");
var classes = require("../dist/taskbuffer.classes");
var should = require("should");
describe("taskbuffer", function () {
describe(".task()", function () {
var testTask;
it("should return a new task to var testTask", function () {
testTask = taskbuffer.task();
});
it("testTask should be instance of Task", function () {
testTask.should.be.instanceof(classes.Task);
});
it("testTask.idle is true", function () {
if (!testTask.idle) {
throw new Error("testTask.idle is not true");
}
});
it("testTask.running is type boolean and initially false", function () {
testTask.running.should.be.type("boolean");
testTask.running.should.be.false();
});
});
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxlQUFlLENBQUMsQ0FBQztBQUMxQyxJQUFJLE9BQU8sR0FBRyxPQUFPLENBQUMsNEJBQTRCLENBQUMsQ0FBQztBQUNwRCxJQUFJLE1BQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7QUFDL0IsUUFBUSxDQUFDLFlBQVksRUFBQztJQUNsQixRQUFRLENBQUMsU0FBUyxFQUFDO1FBQ2YsSUFBSSxRQUFRLENBQUM7UUFDYixFQUFFLENBQUMsMENBQTBDLEVBQUM7WUFDMUMsUUFBUSxHQUFHLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztRQUNqQyxDQUFDLENBQUMsQ0FBQztRQUVILEVBQUUsQ0FBQyxxQ0FBcUMsRUFBQztZQUNyQyxRQUFRLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2hELENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLHVCQUF1QixFQUF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