Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.

Commit

Permalink
add a filestream test
Browse files Browse the repository at this point in the history
  • Loading branch information
clux committed Jul 24, 2014
1 parent bd2316b commit 3ae1da9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
lib-cov/
test/testdump.txt
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash

cd test/
rm -f testdump.txt
$(npm bin)/nodeunit *.js --reporter=$1
cd ..
18 changes: 18 additions & 0 deletions test/filestream.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var logule = require('../')
, l = logule.init(module, "fileTest")
, fs = require('fs');

exports.file = function (t) {
l.info('something for filelog');
setTimeout(function () {
var read = fs.readFileSync('./testdump.txt');
var buf = (read + '').split('\n');
t.ok(buf.length > 1, 'somethig in buffer');
var last = buf[buf.length-2]; // last is empty and penultimate is this..
var json = JSON.parse(last);
t.equal(json.level, 'info', 'file level');
t.deepEqual(json.namespaces, ['fileTest'], 'file namespaces');
t.equal(json.message, 'something for filelog', 'file message');
t.done();
}, 50);
};

0 comments on commit 3ae1da9

Please sign in to comment.