update dependencies and allow empty question set
This commit is contained in:
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +0,0 @@
|
||||
import 'typings-test';
|
37
test/test.js
37
test/test.js
@ -1,37 +0,0 @@
|
||||
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFFaEMsK0NBQThDO0FBRTlDLFFBQVEsQ0FBQyxlQUFlLEVBQUU7SUFDdEIsSUFBSSxZQUF5QyxDQUFBO0lBQzdDLEVBQUUsQ0FBQyxvQ0FBb0MsRUFBRTtRQUNyQyxZQUFZLEdBQUcsSU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Q0FBQyxLQUFLLENBQUMsR0FBRztZQUNSLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7WUFDaEIsTUFBTSxHQUFHLENBQUE7UUFDYixDQUFDLENBQUMsQ0FBQTtJQUNOLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
62
test/test.ts
62
test/test.ts
@ -1,37 +1,33 @@
|
||||
import 'typings-test'
|
||||
import * as should from 'should'
|
||||
import { expect, tap } from 'tapbundle'
|
||||
|
||||
import * as smartinteract from '../dist/index'
|
||||
|
||||
describe('smartinteract', function(){
|
||||
let testInteract: smartinteract.SmartInteract
|
||||
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
|
||||
})
|
||||
})
|
||||
let testInteract: smartinteract.SmartInteract
|
||||
|
||||
tap.test('should create a valid new instance', async () => {
|
||||
testInteract = new smartinteract.SmartInteract()
|
||||
expect(testInteract).to.be.instanceOf(smartinteract.SmartInteract)
|
||||
})
|
||||
|
||||
tap.test('should add question to SmartInteract instance', async () => {
|
||||
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'
|
||||
}])
|
||||
})
|
||||
|
||||
tap.test('should use default value when not in CI', async () => {
|
||||
let answerBucket = await testInteract.runQueue()
|
||||
expect(answerBucket.getAnswerFor('testQuestion1')).to.equal('blue')
|
||||
expect(answerBucket.getAnswerFor('testQuestion2')).to.equal('red')
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
Reference in New Issue
Block a user