edb521d0b2dec955985cd6c3eb21e43322167194.svn-base
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* couchdb-test.js: Tests for instances of the Couchdb transport
*
* (C) 2011 Max Ogden
* MIT LICENSE
*
*/
var path = require('path'),
vows = require('vows'),
fs = require('fs'),
http = require('http'),
assert = require('assert'),
winston = require('../../lib/winston'),
helpers = require('../helpers');
var couchdbTransport = new (winston.transports.Couchdb)({
"host": "localhost",
"port": 4567,
"db": "logs"
});
var server = http.createServer(function (req, res) {
res.end();
});
server.listen(4567);
vows.describe('winston/transports/couchdb').addBatch({
"An instance of the Couchdb Transport": {
"when passed valid options": {
"should have the proper methods defined": function () {
helpers.assertCouchdb(couchdbTransport);
},
"the log() method": helpers.testNpmLevels(couchdbTransport, "should respond with true", function (ign, err, logged) {
assert.isNull(err);
assert.isTrue(logged);
})
}
}
}).addBatch({
"When the tests are over": {
"the server should cleanup": function () {
server.close();
}
}
}).export(module);