2017-04-28 22:44:23 +00:00
|
|
|
import { expect, tap } from 'tapbundle'
|
2017-05-26 13:32:50 +00:00
|
|
|
import * as path from 'path'
|
2017-04-28 22:44:23 +00:00
|
|
|
|
|
|
|
import * as smartscaf from '../dist/index'
|
|
|
|
|
2017-05-25 16:32:53 +00:00
|
|
|
process.env.CI = 'true'
|
|
|
|
|
2017-04-28 22:44:23 +00:00
|
|
|
let testScafTemplate: smartscaf.ScafTemplate
|
|
|
|
|
|
|
|
tap.test('should create new Smartscaf instance', async () => {
|
|
|
|
testScafTemplate = new smartscaf.ScafTemplate()
|
|
|
|
expect(testScafTemplate).to.be.instanceof(smartscaf.ScafTemplate)
|
|
|
|
})
|
2017-04-30 21:58:03 +00:00
|
|
|
|
|
|
|
tap.test('Smartscaf instance -> should read a template directory', async () => {
|
2017-05-03 07:45:22 +00:00
|
|
|
await testScafTemplate.readTemplateFromDir('./test/test_template')
|
2017-05-25 16:32:53 +00:00
|
|
|
expect(testScafTemplate.templateSmartfileArray.length).to.equal(4)
|
2017-05-03 07:45:22 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
tap.test('smartfile -> should accept variables', async () => {
|
|
|
|
await testScafTemplate.supplyVariables({})
|
|
|
|
console.log(testScafTemplate.missingVariables)
|
2017-04-30 21:58:03 +00:00
|
|
|
})
|
|
|
|
|
2017-05-06 23:23:03 +00:00
|
|
|
tap.test('ask cli', async () => {
|
|
|
|
await testScafTemplate.askCliForMissingVariables()
|
|
|
|
})
|
|
|
|
|
2017-05-26 13:32:50 +00:00
|
|
|
tap.test('should output ready rendered template', async () => {
|
|
|
|
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'))
|
|
|
|
})
|
|
|
|
|
2017-04-30 21:58:03 +00:00
|
|
|
tap.start()
|