2016-06-10 01:10:21 +00:00
|
|
|
"use strict";
|
|
|
|
require("typings-test");
|
2016-08-26 07:21:42 +00:00
|
|
|
const smartcli = require("../dist/index");
|
2016-11-19 12:43:06 +00:00
|
|
|
const should = require("should");
|
|
|
|
describe('smartcli.Smartcli class', function () {
|
2016-08-26 07:21:42 +00:00
|
|
|
let smartCliTestObject;
|
2016-11-19 12:43:06 +00:00
|
|
|
describe('new Smartcli()', function () {
|
|
|
|
it('should create a new Smartcli', function () {
|
2016-06-10 02:13:23 +00:00
|
|
|
smartCliTestObject = new smartcli.Smartcli();
|
2016-11-19 12:43:06 +00:00
|
|
|
should(smartCliTestObject).be.instanceof(smartcli.Smartcli);
|
2016-06-10 02:13:23 +00:00
|
|
|
});
|
|
|
|
});
|
2016-11-19 12:43:06 +00:00
|
|
|
describe('.addCommand', function () {
|
|
|
|
it('should add an command', function () {
|
2016-12-18 19:53:50 +00:00
|
|
|
smartCliTestObject.addCommand('awesome');
|
2016-06-10 02:13:23 +00:00
|
|
|
});
|
|
|
|
});
|
2016-11-19 12:43:06 +00:00
|
|
|
describe('.standardTask', function () {
|
|
|
|
it('should start parsing a standardTask', function (done) {
|
2016-06-10 02:13:23 +00:00
|
|
|
smartCliTestObject.standardTask()
|
2016-08-26 07:21:42 +00:00
|
|
|
.then(() => {
|
2016-11-19 12:43:06 +00:00
|
|
|
console.log('this is the standard Task!');
|
2016-06-10 02:13:23 +00:00
|
|
|
});
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
2016-12-18 19:53:50 +00:00
|
|
|
describe('.trigger', function () {
|
2016-12-18 00:36:19 +00:00
|
|
|
let hasExecuted = false;
|
|
|
|
it('should accept a command', function (done) {
|
2016-12-18 19:53:50 +00:00
|
|
|
smartCliTestObject.addTrigger('triggerme')
|
|
|
|
.subscribe(() => {
|
2016-12-18 00:36:19 +00:00
|
|
|
hasExecuted = true;
|
|
|
|
});
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
it('should not have executed yet', function () {
|
|
|
|
should(hasExecuted).be.false();
|
|
|
|
});
|
|
|
|
it('should execute when triggered', function (done) {
|
2016-12-18 19:53:50 +00:00
|
|
|
smartCliTestObject.trigger('triggerme');
|
|
|
|
should(hasExecuted).be.true();
|
|
|
|
done();
|
2016-12-18 00:36:19 +00:00
|
|
|
});
|
|
|
|
});
|
2016-11-19 12:43:06 +00:00
|
|
|
describe('.startParse', function () {
|
|
|
|
it('should start parsing the CLI input', function () {
|
2016-06-10 02:13:23 +00:00
|
|
|
smartCliTestObject.startParse();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2016-12-18 19:53:50 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUVyQiwwQ0FBMEM7QUFDMUMsaUNBQWdDO0FBRWhDLFFBQVEsQ0FBQyx5QkFBeUIsRUFBQztJQUMvQixJQUFJLGtCQUFxQyxDQUFBO0lBQ3pDLFFBQVEsQ0FBQyxnQkFBZ0IsRUFBQztRQUN0QixFQUFFLENBQUMsOEJBQThCLEVBQUM7WUFDOUIsa0JBQWtCLEdBQUcsSUFBSSxRQUFRLENBQUMsUUFBUSxFQUFFLENBQUE7WUFDNUMsTUFBTSxDQUFDLGtCQUFrQixDQUFDLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUE7UUFDL0QsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtJQUNGLFFBQVEsQ0FBQyxhQUFhLEVBQUM7UUFDbkIsRUFBRSxDQUFDLHVCQUF1QixFQUFDO1lBQ3ZCLGtCQUFrQixDQUFDLFVBQVUsQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUM1QyxDQUFDLENBQ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