qenv/test/test.ts

29 lines
907 B
TypeScript
Raw Normal View History

2017-01-21 10:51:30 +00:00
import 'typings-test'
import * as path from 'path'
import { expect } from 'smartchai'
import {Qenv} from '../dist/index'
2016-06-20 08:45:43 +00:00
process.cwd = () => {
2017-01-21 10:51:30 +00:00
return path.join(__dirname,'./assets/')
2016-06-20 08:45:43 +00:00
}
2017-01-21 10:51:30 +00:00
process.env['key1'] = 'original'
2016-06-20 08:45:43 +00:00
2017-01-21 10:57:04 +00:00
let qenvTestObject: Qenv
2017-01-21 10:51:30 +00:00
describe('Qenv class',function(){
it('should create a new class',function(){
qenvTestObject = new Qenv(process.cwd(),process.cwd(),false)
})
it('key1 should be not be overwritten since it is already present',function(){
expect(process.env.key1).to.equal('original')
})
it('key2 should be read from Yml',function(){
expect(process.env.key2).to.equal('fromYml')
})
it('keyValueObjectArray should hold all retrieved values',function(){
expect(qenvTestObject.keyValueObjectArray[0].value).to.equal('original')
expect(qenvTestObject.keyValueObjectArray[1].value).to.equal('fromYml')
2016-06-20 08:45:43 +00:00
})
2017-01-21 10:57:04 +00:00
})