smartscaf/test/test.ts

38 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2023-07-25 15:35:13 +00:00
import { expect, tap } from '@push.rocks/tapbundle';
import * as path from 'path';
2017-04-28 22:44:23 +00:00
2022-06-25 01:19:16 +00:00
import * as smartscaf from '../ts/index.js';
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
let testScafTemplate: smartscaf.ScafTemplate;
2017-04-28 22:44:23 +00:00
tap.test('should create new Smartscaf instance', async () => {
testScafTemplate = new smartscaf.ScafTemplate('./test/test_template');
2022-06-25 01:19:16 +00:00
expect(testScafTemplate).toBeInstanceOf(smartscaf.ScafTemplate);
});
2017-04-30 21:58:03 +00:00
tap.test('Smartscaf instance -> should read a template directory', async () => {
await testScafTemplate.readTemplateFromDir();
2022-06-25 01:19:16 +00:00
expect(testScafTemplate.templateSmartfileArray.length).toEqual(6);
});
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-06 23:23:03 +00:00
2017-08-09 14:57:32 +00:00
tap.test('should have valid supplied variables', async () => {
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 () => {
await testScafTemplate.writeToDisk(path.resolve('./test/test_output'));
});
2017-05-26 13:32:50 +00:00
tap.start();