update to use tapbundle

This commit is contained in:
2017-07-09 19:05:03 +02:00
parent 15e3497c55
commit 3dff5dbbc6
12 changed files with 236 additions and 134 deletions

View File

@@ -1,32 +1,36 @@
import 'typings-test'
import { expect, tap } from 'tapbundle'
import path = require('path')
import * as should from 'should'
// module to test
import npmExtra = require('../dist/index')
let testNpmextra: npmExtra.Npmextra
describe('npmextra', function () {
it('should create a new Npmtextra instance', function () {
testNpmextra = new npmExtra.Npmextra('./test/')
should(testNpmextra).be.instanceof(npmExtra.Npmextra)
})
it('should state wether a npmextra.json exists', function () {
should(testNpmextra.npmextraJsonExists).be.true()
})
it('should pass through default value, if not overriden by config from file', function () {
let testData = testNpmextra.dataFor('testTool', { someKey2: 'someValue2' })
console.log(testData)
should(testData).have.ownProperty('someKey2')
})
it('should read a config file', function () {
let testData = testNpmextra.dataFor<any>(
'testTool',
{
someKey2: 'someValue2'
}
)
should(testData).have.ownProperty('someKey2')
should(testData.testValue).equal(2)
})
tap.test('should create a new Npmtextra instance', async () => {
testNpmextra = new npmExtra.Npmextra('./test/')
expect(testNpmextra).be.instanceof(npmExtra.Npmextra)
})
tap.test('should state wether a npmextra.json exists', async () => {
// tslint:disable-next-line:no-unused-expression
expect(testNpmextra.npmextraJsonExists).be.true
})
tap.test('should pass through default value, if not overriden by config from file', async () => {
let testData = testNpmextra.dataFor('testTool', { someKey2: 'someValue2' })
console.log(testData)
expect(testData).have.ownProperty('someKey2')
})
tap.test('should read a config file', async () => {
let testData = testNpmextra.dataFor<any>(
'testTool',
{
someKey2: 'someValue2'
}
)
expect(testData).have.ownProperty('someKey2')
expect(testData.testValue).equal(2)
})
tap.start()