update dependencies and allow empty question set

This commit is contained in:
2017-07-28 14:27:09 +02:00
parent 653782859c
commit d986d6f9b6
12 changed files with 869 additions and 215 deletions

View File

@@ -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()