37 lines
2.9 KiB
JavaScript
37 lines
2.9 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
const should = require("should");
|
|
const smartinteract = require("../dist/index");
|
|
describe('smartinteract', function () {
|
|
let testInteract;
|
|
it('should create a valid new instance', function () {
|
|
testInteract = new smartinteract.SmartInteract();
|
|
should(testInteract).be.instanceOf(smartinteract.SmartInteract);
|
|
});
|
|
it('should add question to SmartInteract instance', function () {
|
|
testInteract.addQuestions([{
|
|
name: 'testQuestion1',
|
|
type: 'input',
|
|
message: 'what is your favourite color? Answer is blue',
|
|
default: 'blue'
|
|
}]);
|
|
testInteract.addQuestions([{
|
|
name: 'testQuestion2',
|
|
type: 'input',
|
|
message: 'what is your second favourite color? Answer is red',
|
|
default: 'red'
|
|
}]);
|
|
});
|
|
it('should use default value when not in CI', function (done) {
|
|
this.timeout(30000);
|
|
testInteract.runQueue().then(answerBucket => {
|
|
should(answerBucket.getAnswerFor('testQuestion1')).equal('blue');
|
|
should(answerBucket.getAnswerFor('testQuestion2')).equal('red');
|
|
done();
|
|
}).catch(err => {
|
|
console.log(err);
|
|
throw err;
|
|
});
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFFaEMsK0NBQThDO0FBRTlDLFFBQVEsQ0FBQyxlQUFlLEVBQUU7SUFDdEIsSUFBSSxZQUF5QyxDQUFBO0lBQzdDLEVBQUUsQ0FBQyxvQ0FBb0MsRUFBRTtRQUNyQyxZQUFZLEdBQUcsSUFBSSxhQUFhLENBQUMsYUFBYSxFQUFFLENBQUE7UUFDaEQsTUFBTSxDQUFDLFlBQVksQ0FBQyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsYUFBYSxDQUF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