added new NpmExtra class
This commit is contained in:
32
test/test.ts
32
test/test.ts
@@ -2,28 +2,30 @@ import 'typings-test'
|
||||
import path = require('path')
|
||||
import * as should from 'should'
|
||||
|
||||
|
||||
|
||||
import npmExtra = require('../dist/index')
|
||||
|
||||
let testNpmextra: npmExtra.Npmextra
|
||||
|
||||
describe('npmextra',function(){
|
||||
it('should state wether a npmextra.json exists', function() {
|
||||
should(npmExtra.configFilePresent('./test/')).be.true()
|
||||
it('should create a new Npmtextra instance', function(){
|
||||
testNpmextra = new npmExtra.Npmextra('./test/')
|
||||
should(testNpmextra).be.instanceof(npmExtra.Npmextra)
|
||||
})
|
||||
it('should read a config file',function(){
|
||||
let testData = npmExtra.dataFor({
|
||||
toolName: 'testTool',
|
||||
defaultSettings: {someKey2: 'someValue2'},
|
||||
cwd: path.join(process.cwd(),'./test/')
|
||||
})
|
||||
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 = npmExtra.dataFor({
|
||||
toolName: 'testTool',
|
||||
defaultSettings: {someKey2: 'someValue2'},
|
||||
cwd: path.join(process.cwd(),'test/')
|
||||
})
|
||||
let testData = testNpmextra.dataFor(
|
||||
'testTool',
|
||||
{
|
||||
someKey2: 'someValue2'
|
||||
}
|
||||
)
|
||||
should(testData).have.ownProperty('someKey2')
|
||||
should(testData.testValue).equal(2)
|
||||
})
|
||||
|
Reference in New Issue
Block a user