more linting

flush-on-exit
Gareth Jones 11 years ago
parent 1ad4977aec
commit 4fd138f87d

@ -1,69 +1,75 @@
"use strict";
var vows = require('vows') var vows = require('vows')
, assert = require('assert') , assert = require('assert')
, sandbox = require('sandboxed-module'); , sandbox = require('sandboxed-module');
vows.describe('log4js-abspath').addBatch({ vows.describe('log4js-abspath').addBatch({
'options': { 'options': {
topic: function() { topic: function() {
var appenderOptions, var appenderOptions,
log4js = sandbox.require( log4js = sandbox.require(
'../lib/log4js', '../lib/log4js',
{ requires: { requires:
{ './appenders/fake': { './appenders/fake':
{ { name: "fake",
name: "fake", appender: function() {},
appender: function() {}, configure: function(configuration, options) {
configure: function(configuration, options) { appenderOptions = options;
appenderOptions = options; return function() {};
return function() {}; }
} }
} }
}
}
),
config = {
"appenders": [
{
"type" : "fake",
"filename" : "cheesy-wotsits.log"
}
]
};
log4js.configure(config, {
cwd: '/absolute/path/to'
});
return appenderOptions;
},
'should be passed to appenders during configuration': function(options) {
assert.equal(options.cwd, '/absolute/path/to');
} }
),
config = {
"appenders": [
{
"type" : "fake",
"filename" : "cheesy-wotsits.log"
}
]
};
log4js.configure(config, {
cwd: '/absolute/path/to'
});
return appenderOptions;
}, },
'should be passed to appenders during configuration': function(options) {
assert.equal(options.cwd, '/absolute/path/to');
}
},
'file appender': { 'file appender': {
topic: function() { topic: function() {
var fileOpened, var fileOpened,
fileAppender = sandbox.require( fileAppender = sandbox.require(
'../lib/appenders/file', '../lib/appenders/file',
{ requires: { requires:
{ '../streams': { '../streams':
{ { RollingFileStream:
RollingFileStream: function(file) { function(file) {
fileOpened = file; fileOpened = file;
return { return {
on: function() {}, on: function() {},
end: function() {} end: function() {}
}; };
} }
} }
} }
}
);
fileAppender.configure({ filename: "whatever.log", maxLogSize: 10 }, { cwd: '/absolute/path/to' });
return fileOpened;
},
'should prepend options.cwd to config.filename': function(fileOpened) {
assert.equal(fileOpened, "/absolute/path/to/whatever.log");
} }
);
fileAppender.configure(
{
filename: "whatever.log",
maxLogSize: 10
},
{ cwd: '/absolute/path/to' }
);
return fileOpened;
}, },
}).export(module); 'should prepend options.cwd to config.filename': function(fileOpened) {
assert.equal(fileOpened, "/absolute/path/to/whatever.log");
}
},
}).export(module);

Loading…
Cancel
Save