Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[test] use winston transport tests.

  • Loading branch information...
commit d150a1d29da1a0c4221c45d1cb0fbd91caa6a706 1 parent d679c4a
@chjj chjj authored
Showing with 6 additions and 30 deletions.
  1. +6 −30 test/winston-mongodb-test.js
View
36 test/winston-mongodb-test.js
@@ -11,36 +11,12 @@ var path = require('path'),
assert = require('assert'),
winston = require('winston'),
helpers = require('winston/test/helpers'),
+ transport = require('winston/test/transports/transport'),
MongoDB = require('../lib/winston-mongodb').MongoDB;
-
-function assertMongoDB (transport) {
- assert.instanceOf(transport, MongoDB);
- assert.isFunction(transport.log);
-};
-var config = helpers.loadConfig(__dirname),
- transport = new (MongoDB)(config.transports.mongodb);
-
+var config = helpers.loadConfig(__dirname);
+
vows.describe('winston-mongodb').addBatch({
- "An instance of the MongoDB Transport": {
- "should have the proper methods defined": function () {
- assertMongoDB(transport);
- },
- "the log() method": helpers.testNpmLevels(transport, "should log messages to MongoDB", function (ign, err, logged) {
- assert.isTrue(!err);
- assert.isTrue(logged);
- })
- }
-}).addBatch({
- "An instance of the MongoDB Transport": {
- "when the timeout has fired": {
- topic: function () {
- setTimeout(this.callback, config.transports.mongodb.keepAlive);
- },
- "the log() method": helpers.testNpmLevels(transport, "should log messages to MongoDB", function (ign, err, logged) {
- assert.isTrue(!err);
- assert.isTrue(logged);
- })
- }
- }
-}).export(module);
+ "An instance of the MongoDB Transport":
+ transport(MongoDB, config.transports.mongodb)
+}).export(module);
Please sign in to comment.
Something went wrong with that request. Please try again.