webapi-eca/testing/test_config.coffee

48 lines
1.2 KiB
CoffeeScript
Raw Normal View History

path = require 'path'
2014-02-04 07:35:07 +00:00
exports.setUp = ( cb ) =>
logger = require path.join '..', 'js-coffee', 'logging'
log = logger.getLogger
nolog: true
@conf = require path.join '..', 'js-coffee', 'config'
@conf
logger: log
cb()
2014-02-04 07:35:07 +00:00
exports.testRequire = ( test ) =>
test.expect 1
test.ok @conf.isReady(), 'File does not exist!'
test.done()
2014-01-13 14:23:06 +00:00
2014-02-04 07:35:07 +00:00
exports.testParameters = ( test ) =>
reqProp = [
'mode'
'io-level'
'file-level'
'file-path'
]
test.expect 3 + reqProp.length
test.ok @conf.getHttpPort(), 'HTTP port does not exist!'
test.ok @conf.getDbPort(), 'DB port does not exist!'
logconf = @conf.getLogConf()
test.ok logconf, 'Log config does not exist!'
for prop in reqProp
test.ok logconf[prop], "Log conf property #{ prop } does not exist!"
test.done()
2014-01-13 14:23:06 +00:00
2014-02-04 07:35:07 +00:00
exports.testDifferentConfigFile = ( test ) =>
test.expect 1
@conf
nolog: true
2014-02-10 21:28:10 +00:00
configPath: path.join 'testing', 'files', 'jsonWrongConfig.json'
test.ok @conf.isReady(), 'Different path not loaded!'
test.done()
2014-01-13 14:23:06 +00:00
2014-02-04 07:35:07 +00:00
exports.testNoConfigFile = ( test ) =>
test.expect 1
@conf
nolog: true
configPath: 'wrongpath.file'
test.strictEqual @conf.isReady(), false, 'Wrong path still loaded!'
test.done()