npmextra/test/test.ts

33 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2016-09-23 20:13:06 +00:00
import 'typings-test'
import path = require('path')
import * as should from 'should'
2016-07-16 23:23:22 +00:00
2016-09-23 20:13:06 +00:00
import npmExtra = require('../dist/index')
2016-09-24 14:44:48 +00:00
let testNpmextra: npmExtra.Npmextra
2016-09-23 20:13:06 +00:00
describe('npmextra',function(){
2016-09-24 14:44:48 +00:00
it('should create a new Npmtextra instance', function(){
testNpmextra = new npmExtra.Npmextra('./test/')
should(testNpmextra).be.instanceof(npmExtra.Npmextra)
})
2016-09-23 20:13:06 +00:00
it('should state wether a npmextra.json exists', function() {
2016-09-24 14:44:48 +00:00
should(testNpmextra.npmextraJsonExists).be.true()
2016-09-23 20:13:06 +00:00
})
2016-09-24 14:44:48 +00:00
it('should pass through default value, if not overriden by config from file',function(){
let testData = testNpmextra.dataFor('testTool', {someKey2: 'someValue2'})
console.log(testData)
2016-09-23 20:13:06 +00:00
should(testData).have.ownProperty('someKey2')
})
it('should read a config file',function(){
2016-09-24 14:44:48 +00:00
let testData = testNpmextra.dataFor(
'testTool',
{
someKey2: 'someValue2'
}
)
2016-09-23 20:13:06 +00:00
should(testData).have.ownProperty('someKey2')
should(testData.testValue).equal(2)
})
})