2017-04-19 18:02:43 +00:00
|
|
|
import { tap, expect } from 'tapbundle'
|
2018-02-13 23:12:21 +00:00
|
|
|
import * as smartenv from '../ts/index'
|
2017-04-19 18:02:43 +00:00
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
let testEnv: smartenv.Smartenv
|
2015-12-10 14:52:14 +00:00
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
tap.test('should print env', async () => {
|
|
|
|
testEnv = new smartenv.Smartenv()
|
2017-04-20 22:04:28 +00:00
|
|
|
})
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
tap.test('should print a overview to console', async () => {
|
|
|
|
testEnv.printEnv()
|
2017-04-20 22:04:28 +00:00
|
|
|
})
|
2015-11-28 13:49:44 +00:00
|
|
|
|
2018-02-13 23:12:21 +00:00
|
|
|
tap.test('should get os', async () => {
|
2018-02-13 23:28:56 +00:00
|
|
|
let resultMac = await testEnv.isMacAsync()
|
2018-02-13 23:12:21 +00:00
|
|
|
let resultLinux = await testEnv.isLinuxAsync()
|
|
|
|
let resultWindows = await testEnv.isWindowsAsync()
|
|
|
|
const osModule = await import('os')
|
|
|
|
if (resultMac) {
|
|
|
|
expect(osModule.platform()).to.equal('darwin');
|
|
|
|
console.log('platform is Mac!')
|
|
|
|
} else if (resultLinux) {
|
|
|
|
expect(osModule.platform()).to.equal('linux');
|
|
|
|
console.log('platform is Linux!')
|
|
|
|
} else {
|
|
|
|
expect(osModule.platform()).to.equal('win32');
|
|
|
|
console.log('platform is Windows!')
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2018-02-13 23:28:56 +00:00
|
|
|
tap.test('should state wether we are in CI', async () => {
|
|
|
|
if(process.env.CI) {
|
|
|
|
expect(testEnv.isCI).to.be.true()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-05-17 13:59:10 +00:00
|
|
|
tap.start()
|