test: ensure parent type guard is working

master
Ryan Graham 2014-08-08 18:17:14 -07:00
parent 58df808325
commit e4ea3fb05f
1 changed files with 14 additions and 0 deletions

View File

@ -132,3 +132,17 @@ test('ensure Logger child() options', function (t) {
t.end();
});
test('ensure Logger() rejects non-Logger parents', function (t) {
var dad = new Logger({name: 'dad', streams: []});
t.throws(function () { new Logger({}, {}); },
/invalid Logger creation: do not pass a second arg/,
'Logger arguments must be valid');
t.doesNotThrow(function () { new Logger(dad, {}); },
'Logger allows Logger instance as parent');
t.end();
});