Skip to content

Commit

Permalink
more tests, small enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaidma committed Sep 19, 2016
1 parent b43ba93 commit e2a7541
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function logging (options) {
logging.preload = function () {
var seneca = this
var so = seneca.options()
var logspec = so.log.basic || so.log
var logspec = so.log.basic || so.log || {}

if (_.isString(logspec)) {
logspec = {level: logspec}
Expand Down
19 changes: 18 additions & 1 deletion test/seneca-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,24 @@ describe('seneca --seneca.log arguments tests', function () {
it('incorrect arg --seneca.log=level:', function (done) {
process.argv = ['', '', '--seneca.log=level:']
var si = Seneca()
expect(_.isMatch(si.export('options').log, {})).to.be.true()
expect(_.isObject(si.export('options').log)).to.be.true()
expect(si.export('options').log.level).to.not.exist()

done()
})

it('incorrect arg --seneca.log.level.abc', function (done) {
process.argv = ['', '', '--seneca.log.level.abc']
var si = Seneca()
expect(_.isMatch(si.export('options').log, { level: 'abc' })).to.be.true()

done()
})

it('incorrect arg --seneca.log.abc', function (done) {
process.argv = ['', '', '--seneca.log.abc']
var si = Seneca()
expect(_.isMatch(si.export('options').log, { level: 'abc' })).to.be.true()

done()
})
Expand Down

0 comments on commit e2a7541

Please sign in to comment.