update to latest standards
This commit is contained in:
45
test/test.ts
45
test/test.ts
@@ -1,28 +1,27 @@
|
||||
import 'typings-test'
|
||||
import * as path from 'path'
|
||||
import { expect } from 'smartchai'
|
||||
import {Qenv} from '../dist/index'
|
||||
import { tap, expect } from 'tapbundle'
|
||||
import * as qenv from '../dist/index'
|
||||
|
||||
process.cwd = () => {
|
||||
return path.join(__dirname,'./assets/')
|
||||
}
|
||||
process.env[ 'key1' ] = 'original'
|
||||
|
||||
process.env['key1'] = 'original'
|
||||
|
||||
let qenvTestObject: Qenv
|
||||
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')
|
||||
})
|
||||
let qenvTestObject: qenv.Qenv
|
||||
|
||||
tap.test('should create a new class', async () => {
|
||||
qenvTestObject = new qenv.Qenv(path.join(__dirname, 'assets'), path.join(__dirname, 'assets'), false)
|
||||
expect(qenvTestObject).to.be.instanceof(qenv.Qenv)
|
||||
})
|
||||
|
||||
tap.test('key1 should be not be overwritten since it is already present', async () => {
|
||||
expect(process.env.key1).to.equal('original')
|
||||
})
|
||||
|
||||
tap.test('key2 should be read from Yml', async () => {
|
||||
expect(process.env.key2).to.equal('fromYml')
|
||||
})
|
||||
|
||||
tap.test('keyValueObjectArray should hold all retrieved values', async () => {
|
||||
expect(qenvTestObject.keyValueObjectArray[ 0 ].value).to.equal('original')
|
||||
expect(qenvTestObject.keyValueObjectArray[ 1 ].value).to.equal('fromYml')
|
||||
})
|
||||
|
||||
tap.start()
|
||||
|
Reference in New Issue
Block a user