<commit_before>/*
 * couchdb-test.js: Tests for instances of the Couchdb transport
 *
 * (C) 2011 <NAME>
 * 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": 5984,
  "db": "logs"
});

var server = http.createServer(function (req, res) {
  res.end();
});

server.listen(5984);

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);<commit_msg>[fix] Update couchdb-test.js to use a silly port which wont fail when Im running Couchdb for something else<commit_after>/*
 * couchdb-test.js: Tests for instances of the Couchdb transport
 *
 * (C) 2011 <NAME>
 * 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": 1337,
  "db": "logs"
});

var server = http.createServer(function (req, res) {
  res.end();
});

server.listen(1337);

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);
{'fraction_non_alphanumeric': 0.16227347611202636, 'fraction_numerical': 0.009884678747940691, 'mean_word_length': 3.3220640569395017, 'pattern_counts': {'":': 18, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2931468', 'n_tokens_mistral': 804, 'n_tokens_neox': 773, 'n_words': 200}