2014-02-04 15:40:32 +00:00
|
|
|
path = require 'path'
|
2014-04-05 01:09:40 +00:00
|
|
|
logger = require path.join '..', 'js', 'logging'
|
2014-04-02 13:54:20 +00:00
|
|
|
log = logger.getLogger
|
2014-04-16 15:42:56 +00:00
|
|
|
nolog: true
|
2014-04-05 01:09:40 +00:00
|
|
|
conf = require path.join '..', 'js', 'config'
|
2014-04-02 13:54:20 +00:00
|
|
|
conf
|
2014-04-16 15:42:56 +00:00
|
|
|
logger: log
|
2014-02-04 15:40:32 +00:00
|
|
|
|
2014-04-02 13:54:20 +00:00
|
|
|
exports.testRequire = ( test ) ->
|
2014-04-16 15:42:56 +00:00
|
|
|
test.expect 1
|
|
|
|
|
test.ok conf.isReady(), 'File does not exist!'
|
|
|
|
|
test.done()
|
2014-01-13 14:23:06 +00:00
|
|
|
|
2014-04-02 13:54:20 +00:00
|
|
|
exports.testParameters = ( test ) ->
|
2014-04-16 15:42:56 +00:00
|
|
|
reqProp = [
|
|
|
|
|
'mode'
|
|
|
|
|
'io-level'
|
|
|
|
|
'file-level'
|
|
|
|
|
]
|
|
|
|
|
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-04-02 13:54:20 +00:00
|
|
|
exports.testDifferentConfigFile = ( test ) ->
|
2014-04-16 15:42:56 +00:00
|
|
|
test.expect 1
|
|
|
|
|
conf
|
|
|
|
|
# nolog: true
|
|
|
|
|
configPath: path.join 'testing', 'files', 'jsonTestConfig.json'
|
|
|
|
|
test.ok conf.isReady(), 'Different path not loaded!'
|
|
|
|
|
test.done()
|
2014-01-13 14:23:06 +00:00
|
|
|
|
2014-04-02 13:54:20 +00:00
|
|
|
exports.testNoConfigFile = ( test ) ->
|
2014-04-16 15:42:56 +00:00
|
|
|
test.expect 1
|
|
|
|
|
conf
|
|
|
|
|
nolog: true
|
|
|
|
|
configPath: 'wrongpath.file'
|
|
|
|
|
test.strictEqual conf.isReady(), false, 'Wrong path still loaded!'
|
|
|
|
|
test.done()
|