smartcli/test/test.js
2016-12-18 20:53:50 +01:00

51 lines
3.6 KiB
JavaScript

"use strict";
require("typings-test");
const smartcli = require("../dist/index");
const should = require("should");
describe('smartcli.Smartcli class', function () {
let smartCliTestObject;
describe('new Smartcli()', function () {
it('should create a new Smartcli', function () {
smartCliTestObject = new smartcli.Smartcli();
should(smartCliTestObject).be.instanceof(smartcli.Smartcli);
});
});
describe('.addCommand', function () {
it('should add an command', function () {
smartCliTestObject.addCommand('awesome');
});
});
describe('.standardTask', function () {
it('should start parsing a standardTask', function (done) {
smartCliTestObject.standardTask()
.then(() => {
console.log('this is the standard Task!');
});
done();
});
});
describe('.trigger', function () {
let hasExecuted = false;
it('should accept a command', function (done) {
smartCliTestObject.addTrigger('triggerme')
.subscribe(() => {
hasExecuted = true;
});
done();
});
it('should not have executed yet', function () {
should(hasExecuted).be.false();
});
it('should execute when triggered', function (done) {
smartCliTestObject.trigger('triggerme');
should(hasExecuted).be.true();
done();
});
});
describe('.startParse', function () {
it('should start parsing the CLI input', function () {
smartCliTestObject.startParse();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUVyQiwwQ0FBMEM7QUFDMUMsaUNBQWdDO0FBRWhDLFFBQVEsQ0FBQyx5QkFBeUIsRUFBQztJQUMvQixJQUFJLGtCQUFxQyxDQUFBO0lBQ3pDLFFBQVEsQ0FBQyxnQkFBZ0IsRUFBQztRQUN0QixFQUFFLENBQUMsOEJBQThCLEVBQUM7WUFDOUIsa0JBQWtCLEdBQUcsSUFBSSxRQUFRLENBQUMsUUFBUSxFQUFFLENBQUE7WUFDNUMsTUFBTSxDQUFDLGtCQUFrQixDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsUUFB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