BREAKING CHANGE(update scope to @pushrocks): update

This commit is contained in:
2018-08-27 23:04:15 +02:00
parent e2a93e1f47
commit 9ac0a94f59
32 changed files with 1268 additions and 1219 deletions

View File

@ -1,28 +1,29 @@
import { expect, tap } from 'tapbundle'
import * as smarthbs from '../dist/index'
import * as path from 'path'
import { expect, tap } from '@pushrocks/tapbundle';
import * as smarthbs from '../ts/index';
import * as path from 'path';
let testHbsDir = path.join(__dirname, 'hbs_testfiles')
let testPartialDir = path.join(testHbsDir, 'partials')
let testResultDir = path.join(__dirname, 'testresult')
let testHbsDir = path.join(__dirname, 'hbs_testfiles');
let testPartialDir = path.join(testHbsDir, 'partials');
let testResultDir = path.join(__dirname, 'testresult');
tap.test('smarthbs -> should create partials', async () => {
await smarthbs.registerPartialDir(testPartialDir)
})
await smarthbs.registerPartialDir(testPartialDir);
});
tap.test('smarthbs -> should compile a directory', async () => {
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json')
})
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json');
});
tap.test('', async () => {
let templateString = '{{{firstVar}}} {{secondVar}}'
let templateVars = await smarthbs.findVarsInHbsString(templateString)
expect(templateVars).to.include('firstVar')
expect(templateVars).to.include('secondVar')
})
let templateString = '{{{firstVar}}} {{secondVar}}';
let templateVars = await smarthbs.findVarsInHbsString(templateString);
expect(templateVars).to.include('firstVar');
expect(templateVars).to.include('secondVar');
});
tap.test('', async () => {
let templateString = '{{{firstVar}}} {{secondVar}} {{thirdVar}} {{fourthVar}} {{fourthVar.someKey}} {{fourthVar.otherKey.nextKey}}'
let templateString =
'{{{firstVar}}} {{secondVar}} {{thirdVar}} {{fourthVar}} {{fourthVar.someKey}} {{fourthVar.otherKey.nextKey}}';
let missingVars = await smarthbs.checkVarsSatisfaction(templateString, {
firstVar: 'hi',
secondVar: 'hello',
@ -31,9 +32,9 @@ tap.test('', async () => {
nextKey: 'wow'
}
}
})
expect(missingVars).to.contain('thirdVar', 'fourthVar.someKey')
expect(missingVars).to.not.contain('secondVar', 'fourthVar.otherKey.nextKey')
})
});
expect(missingVars).to.contain('thirdVar', 'fourthVar.someKey');
expect(missingVars).to.not.contain('secondVar', 'fourthVar.otherKey.nextKey');
});
tap.start()
tap.start();