moved streams code around, added stub for DateRollingFileStream
This commit is contained in:
49
test/streams/DateRollingFileStream-test.js
Normal file
49
test/streams/DateRollingFileStream-test.js
Normal file
@@ -0,0 +1,49 @@
|
||||
var vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
fs = require('fs'),
|
||||
DateRollingFileStream = require('../../lib/streams').DateRollingFileStream;
|
||||
|
||||
vows.describe('DateRollingFileStream').addBatch({
|
||||
'arguments': {
|
||||
topic: new DateRollingFileStream('test-date-rolling-file-stream', 'yyyy-mm-dd.hh'),
|
||||
|
||||
'should take a filename and a pattern and return a FileWriteStream': function(stream) {
|
||||
assert.equal(stream.filename, 'test-date-rolling-file-stream');
|
||||
assert.equal(stream.pattern, 'yyyy-mm-dd.hh');
|
||||
assert.instanceOf(stream, fs.FileWriteStream);
|
||||
},
|
||||
'with default settings for the underlying stream': function(stream) {
|
||||
assert.equal(stream.mode, 420);
|
||||
assert.equal(stream.flags, 'a');
|
||||
assert.equal(stream.encoding, 'utf8');
|
||||
}
|
||||
},
|
||||
|
||||
'default arguments': {
|
||||
topic: new DateRollingFileStream('test-date-rolling-file-stream'),
|
||||
|
||||
'pattern should be yyyy-mm-dd': function(stream) {
|
||||
assert.equal(stream.pattern, 'yyyy-mm-dd');
|
||||
}
|
||||
},
|
||||
|
||||
'with stream arguments': {
|
||||
topic: new DateRollingFileStream('test-rolling-file-stream', 'yyyy-mm-dd', { mode: 0666 }),
|
||||
|
||||
'should pass them to the underlying stream': function(stream) {
|
||||
assert.equal(stream.mode, 0666);
|
||||
}
|
||||
},
|
||||
|
||||
'with stream arguments but no pattern': {
|
||||
topic: new DateRollingFileStream('test-rolling-file-stream', { mode: 0666 }),
|
||||
|
||||
'should pass them to the underlying stream': function(stream) {
|
||||
assert.equal(stream.mode, 0666);
|
||||
},
|
||||
'should use default pattern': function(stream) {
|
||||
assert.equal(stream.pattern, 'yyyy-mm-dd');
|
||||
}
|
||||
}
|
||||
|
||||
}).exportTo(module);
|
||||
@@ -1,7 +1,7 @@
|
||||
var vows = require('vows')
|
||||
, assert = require('assert')
|
||||
, events = require('events')
|
||||
, BufferedWriteStream = require('../lib/streams').BufferedWriteStream;
|
||||
, BufferedWriteStream = require('../../lib/streams').BufferedWriteStream;
|
||||
|
||||
function FakeStream() {
|
||||
this.writes = [];
|
||||
@@ -127,4 +127,4 @@ vows.describe('BufferedWriteStream').addBatch({
|
||||
}
|
||||
}
|
||||
|
||||
}).exportTo(module);
|
||||
}).exportTo(module);
|
||||
@@ -2,7 +2,7 @@ var vows = require('vows')
|
||||
, assert = require('assert')
|
||||
, events = require('events')
|
||||
, fs = require('fs')
|
||||
, RollingFileStream = require('../lib/streams').RollingFileStream;
|
||||
, RollingFileStream = require('../../lib/streams').RollingFileStream;
|
||||
|
||||
function remove(filename) {
|
||||
try {
|
||||
Reference in New Issue
Block a user