/*
 * winston-rsyslog-test.js: Tests for instances of the Rsyslog transport
 *
 * (C) 2013 Fabio Grande
 * MIT LICENSE
 *
 */

var path = require('path'),
  vows = require('vows'),
  assert = require('assert'),
  winston = require('winston'),
  helpers = require('winston/test/helpers'),
  Rsyslog = require('../lib/winston-rsyslog').Rsyslog;

var tokenTransport,
  config;

try {
  config = require('./config');
  console.log('Using configuration file test/config.json.');
  tokenTransport = new Rsyslog(config.transports.rsyslog);
} catch (e) {
  console.log('Cannot read file test/config.json. Using defaults.');
  tokenTransport = new Rsyslog();
}

function assertRsyslog(transport) {
  assert.instanceOf(transport, Rsyslog);
  assert.isFunction(transport.log);
}

vows.describe('winston-rsyslog').addBatch({
  "An instance of the Rsyslog Transport": {
    "should have the proper methods defined": function () {
      assertRsyslog(tokenTransport);
    },
    "the log() method": helpers.testSyslogLevels(tokenTransport, "should log messages to rsyslog", function (ign, err, logged) {
      assert.isNull(err);
      assert.isTrue(logged);
    })
  }
}).export(module);

@@ -83,16 +83,21 @@
 (C) 2013
+-2015
  Fabio G
@@ -361,18 +361,16 @@
 ansport,
-%0A 
  config;
@@ -653,124 +653,8 @@
 %0A%7D%0A%0A
-function assertRsyslog(transport) %7B%0A  assert.instanceOf(transport, Rsyslog);%0A  assert.isFunction(transport.log);%0A%7D%0A%0A
 vows
@@ -695,17 +695,19 @@
 tch(%7B%0A  
-%22
+  '
 An insta
@@ -738,17 +738,17 @@
 port
-%22
+'
 : %7B%0A    
 %22sho
@@ -743,17 +743,21 @@
 : %7B%0A    
-%22
+    '
 should h
@@ -786,17 +786,17 @@
  defined
-%22
+'
 : functi
@@ -801,14 +801,19 @@
 tion
- 
 () %7B%0A
+      
     
@@ -853,16 +853,24 @@
     
+   
+ 
 %7D,%0A    
-%22
+    '
 the 
@@ -881,17 +881,17 @@
 ) method
-%22
+'
 : helper
@@ -925,17 +925,17 @@
 nsport, 
-%22
+'
 should l
@@ -960,9 +960,9 @@
 slog
-%22
+'
 , fu
@@ -967,17 +967,16 @@
 function
- 
 (ign, er
@@ -990,24 +990,30 @@
 ed) %7B%0A      
+   
+   
 assert.isNul
@@ -1022,24 +1022,30 @@
 err);%0A      
+  
+    
 assert.isTru
@@ -1059,15 +1059,21 @@
 d);%0A
+    
     %7D)%0A
+  
   %7D%0A

test clean up