2018-08-27 21:55:14 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
|
|
|
import * as path from 'path';
|
2017-04-28 22:44:23 +00:00
|
|
|
|
2018-08-27 21:55:14 +00:00
|
|
|
import * as smartscaf from '../ts/index';
|
2017-04-28 22:44:23 +00:00
|
|
|
|
2019-01-27 17:55:38 +00:00
|
|
|
process.env.CI = 'true';
|
2017-05-25 16:32:53 +00:00
|
|
|
|
2018-08-27 21:55:14 +00:00
|
|
|
let testScafTemplate: smartscaf.ScafTemplate;
|
2017-04-28 22:44:23 +00:00
|
|
|
|
|
|
|
tap.test('should create new Smartscaf instance', async () => {
|
2018-08-30 20:43:22 +00:00
|
|
|
testScafTemplate = new smartscaf.ScafTemplate('./test/test_template');
|
2018-08-27 21:55:14 +00:00
|
|
|
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 () => {
|
2018-08-30 20:43:22 +00:00
|
|
|
await testScafTemplate.readTemplateFromDir();
|
2018-10-04 14:04:42 +00:00
|
|
|
expect(testScafTemplate.templateSmartfileArray.length).to.equal(6);
|
2018-08-27 21:55:14 +00:00
|
|
|
});
|
2017-05-03 07:45:22 +00:00
|
|
|
|
|
|
|
tap.test('smartfile -> should accept variables', async () => {
|
2018-08-27 21:55:14 +00:00
|
|
|
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 () => {
|
2018-08-27 21:55:14 +00:00
|
|
|
await testScafTemplate.askCliForMissingVariables();
|
|
|
|
});
|
2017-05-06 23:23:03 +00:00
|
|
|
|
2017-08-09 14:57:32 +00:00
|
|
|
tap.test('should have valid supplied variables', async () => {
|
2018-08-27 21:55:14 +00:00
|
|
|
console.log(testScafTemplate.suppliedVariables);
|
|
|
|
});
|
2017-08-09 14:57:32 +00:00
|
|
|
|
2017-05-26 13:32:50 +00:00
|
|
|
tap.test('should output ready rendered template', async () => {
|
2018-08-27 21:55:14 +00:00
|
|
|
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'));
|
|
|
|
});
|
2017-05-26 13:32:50 +00:00
|
|
|
|
2018-08-27 21:55:14 +00:00
|
|
|
tap.start();
|