test: ensure parent type guard is working

This commit is contained in:
Ryan Graham 2014-08-08 18:17:14 -07:00
parent 58df808325
commit e4ea3fb05f

View file

@ -132,3 +132,17 @@ test('ensure Logger child() options', function (t) {
t.end(); 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();
});