1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-01 11:31:22 +00:00
haste-server/node_modules/winston/test/transports/loggly-test.js
2012-02-06 14:09:01 -05:00

61 lines
1.8 KiB
JavaScript

/*
* loggly-test.js: Tests for instances of the Loggly transport
*
* (C) 2010 Charlie Robbins
* MIT LICENSE
*
*/
var path = require('path'),
vows = require('vows'),
assert = require('assert'),
winston = require('../../lib/winston'),
helpers = require('../helpers');
var config = helpers.loadConfig();
if (!config) {
return;
}
var tokenTransport = new (winston.transports.Loggly)({
subdomain: config.transports.loggly.subdomain,
inputToken: config.transports.loggly.inputToken
}),
nameTransport = new (winston.transports.Loggly)({
subdomain: config.transports.loggly.subdomain,
inputName: config.transports.loggly.inputName,
auth: config.transports.loggly.auth
});
vows.describe('winston/transports/loggly').addBatch({
"An instance of the Loggly Transport": {
"when passed an input token": {
"should have the proper methods defined": function () {
helpers.assertLoggly(tokenTransport);
},
"the log() method": helpers.testNpmLevels(tokenTransport, "should log messages to loggly", function (ign, err, logged) {
assert.isNull(err);
assert.isTrue(logged);
}),
"the log() method with no metadata": {
topic: function () {
tokenTransport.log('info', 'test-message', null, this.callback.bind(null, null));
},
"should respond immediately": function () {
assert.isTrue(true);
}
}
},
"when passed an input name": {
"should have the proper methods defined": function () {
helpers.assertLoggly(nameTransport);
},
"the log() method": helpers.testNpmLevels(nameTransport, "should log messages to loggly", function (ign, err, result) {
assert.isNull(err);
assert.isTrue(result === true || result.response === 'ok');
})
}
}
}).export(module);