more linting

This commit is contained in:
Gareth Jones 2013-05-27 07:48:29 +10:00
parent 1ad4977aec
commit 4fd138f87d

View File

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