more linting
This commit is contained in:
parent
4fd138f87d
commit
9853e13429
@ -1,3 +1,4 @@
|
|||||||
|
"use strict";
|
||||||
var vows = require('vows')
|
var vows = require('vows')
|
||||||
, assert = require('assert')
|
, assert = require('assert')
|
||||||
, levels = require('../lib/levels');
|
, levels = require('../lib/levels');
|
||||||
@ -47,117 +48,304 @@ vows.describe('levels').addBatch({
|
|||||||
'ALL': {
|
'ALL': {
|
||||||
topic: levels.ALL,
|
topic: levels.ALL,
|
||||||
'should be less than the other levels': function(all) {
|
'should be less than the other levels': function(all) {
|
||||||
assertThat(all).isLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(all).isLessThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'should be greater than no levels': function(all) {
|
'should be greater than no levels': function(all) {
|
||||||
assertThat(all).isNotGreaterThanOrEqualTo([levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(all).isNotGreaterThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'should only be equal to ALL': function(all) {
|
'should only be equal to ALL': function(all) {
|
||||||
assertThat(all).isEqualTo([levels.toLevel("ALL")]);
|
assertThat(all).isEqualTo([levels.toLevel("ALL")]);
|
||||||
assertThat(all).isNotEqualTo([levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(all).isNotEqualTo(
|
||||||
|
[
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'TRACE': {
|
'TRACE': {
|
||||||
topic: levels.TRACE,
|
topic: levels.TRACE,
|
||||||
'should be less than DEBUG': function(trace) {
|
'should be less than DEBUG': function(trace) {
|
||||||
assertThat(trace).isLessThanOrEqualTo([levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isLessThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
assertThat(trace).isNotLessThanOrEqualTo([levels.ALL]);
|
assertThat(trace).isNotLessThanOrEqualTo([levels.ALL]);
|
||||||
},
|
},
|
||||||
'should be greater than ALL': function(trace) {
|
'should be greater than ALL': function(trace) {
|
||||||
assertThat(trace).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE]);
|
assertThat(trace).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE]);
|
||||||
assertThat(trace).isNotGreaterThanOrEqualTo([levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotGreaterThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'should only be equal to TRACE': function(trace) {
|
'should only be equal to TRACE': function(trace) {
|
||||||
assertThat(trace).isEqualTo([levels.toLevel("TRACE")]);
|
assertThat(trace).isEqualTo([levels.toLevel("TRACE")]);
|
||||||
assertThat(trace).isNotEqualTo([levels.ALL, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotEqualTo(
|
||||||
|
[
|
||||||
|
levels.ALL,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'DEBUG': {
|
'DEBUG': {
|
||||||
topic: levels.DEBUG,
|
topic: levels.DEBUG,
|
||||||
'should be less than INFO': function(debug) {
|
'should be less than INFO': function(debug) {
|
||||||
assertThat(debug).isLessThanOrEqualTo([levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(debug).isLessThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
assertThat(debug).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE]);
|
assertThat(debug).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE]);
|
||||||
},
|
},
|
||||||
'should be greater than TRACE': function(debug) {
|
'should be greater than TRACE': function(debug) {
|
||||||
assertThat(debug).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE]);
|
assertThat(debug).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE]);
|
||||||
assertThat(debug).isNotGreaterThanOrEqualTo([levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(debug).isNotGreaterThanOrEqualTo(
|
||||||
|
[
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'should only be equal to DEBUG': function(trace) {
|
'should only be equal to DEBUG': function(trace) {
|
||||||
assertThat(trace).isEqualTo([levels.toLevel("DEBUG")]);
|
assertThat(trace).isEqualTo([levels.toLevel("DEBUG")]);
|
||||||
assertThat(trace).isNotEqualTo([levels.ALL, levels.TRACE, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotEqualTo(
|
||||||
|
[
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'INFO': {
|
'INFO': {
|
||||||
topic: levels.INFO,
|
topic: levels.INFO,
|
||||||
'should be less than WARN': function(info) {
|
'should be less than WARN': function(info) {
|
||||||
assertThat(info).isLessThanOrEqualTo([levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(info).isLessThanOrEqualTo([
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
assertThat(info).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG]);
|
assertThat(info).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG]);
|
||||||
},
|
},
|
||||||
'should be greater than DEBUG': function(info) {
|
'should be greater than DEBUG': function(info) {
|
||||||
assertThat(info).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG]);
|
assertThat(info).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG]);
|
||||||
assertThat(info).isNotGreaterThanOrEqualTo([levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(info).isNotGreaterThanOrEqualTo([
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should only be equal to INFO': function(trace) {
|
'should only be equal to INFO': function(trace) {
|
||||||
assertThat(trace).isEqualTo([levels.toLevel("INFO")]);
|
assertThat(trace).isEqualTo([levels.toLevel("INFO")]);
|
||||||
assertThat(trace).isNotEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.WARN, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'WARN': {
|
'WARN': {
|
||||||
topic: levels.WARN,
|
topic: levels.WARN,
|
||||||
'should be less than ERROR': function(warn) {
|
'should be less than ERROR': function(warn) {
|
||||||
assertThat(warn).isLessThanOrEqualTo([levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(warn).isLessThanOrEqualTo([levels.ERROR, levels.FATAL, levels.OFF]);
|
||||||
assertThat(warn).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO]);
|
assertThat(warn).isNotLessThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should be greater than INFO': function(warn) {
|
'should be greater than INFO': function(warn) {
|
||||||
assertThat(warn).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO]);
|
assertThat(warn).isGreaterThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO
|
||||||
|
]);
|
||||||
assertThat(warn).isNotGreaterThanOrEqualTo([levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(warn).isNotGreaterThanOrEqualTo([levels.ERROR, levels.FATAL, levels.OFF]);
|
||||||
},
|
},
|
||||||
'should only be equal to WARN': function(trace) {
|
'should only be equal to WARN': function(trace) {
|
||||||
assertThat(trace).isEqualTo([levels.toLevel("WARN")]);
|
assertThat(trace).isEqualTo([levels.toLevel("WARN")]);
|
||||||
assertThat(trace).isNotEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.ERROR, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'ERROR': {
|
'ERROR': {
|
||||||
topic: levels.ERROR,
|
topic: levels.ERROR,
|
||||||
'should be less than FATAL': function(error) {
|
'should be less than FATAL': function(error) {
|
||||||
assertThat(error).isLessThanOrEqualTo([levels.FATAL, levels.OFF]);
|
assertThat(error).isLessThanOrEqualTo([levels.FATAL, levels.OFF]);
|
||||||
assertThat(error).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN]);
|
assertThat(error).isNotLessThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should be greater than WARN': function(error) {
|
'should be greater than WARN': function(error) {
|
||||||
assertThat(error).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN]);
|
assertThat(error).isGreaterThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN
|
||||||
|
]);
|
||||||
assertThat(error).isNotGreaterThanOrEqualTo([levels.FATAL, levels.OFF]);
|
assertThat(error).isNotGreaterThanOrEqualTo([levels.FATAL, levels.OFF]);
|
||||||
},
|
},
|
||||||
'should only be equal to ERROR': function(trace) {
|
'should only be equal to ERROR': function(trace) {
|
||||||
assertThat(trace).isEqualTo([levels.toLevel("ERROR")]);
|
assertThat(trace).isEqualTo([levels.toLevel("ERROR")]);
|
||||||
assertThat(trace).isNotEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.FATAL, levels.OFF]);
|
assertThat(trace).isNotEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.FATAL,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'FATAL': {
|
'FATAL': {
|
||||||
topic: levels.FATAL,
|
topic: levels.FATAL,
|
||||||
'should be less than OFF': function(fatal) {
|
'should be less than OFF': function(fatal) {
|
||||||
assertThat(fatal).isLessThanOrEqualTo([levels.OFF]);
|
assertThat(fatal).isLessThanOrEqualTo([levels.OFF]);
|
||||||
assertThat(fatal).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR]);
|
assertThat(fatal).isNotLessThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should be greater than ERROR': function(fatal) {
|
'should be greater than ERROR': function(fatal) {
|
||||||
assertThat(fatal).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR]);
|
assertThat(fatal).isGreaterThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR
|
||||||
|
]);
|
||||||
assertThat(fatal).isNotGreaterThanOrEqualTo([levels.OFF]);
|
assertThat(fatal).isNotGreaterThanOrEqualTo([levels.OFF]);
|
||||||
},
|
},
|
||||||
'should only be equal to FATAL': function(fatal) {
|
'should only be equal to FATAL': function(fatal) {
|
||||||
assertThat(fatal).isEqualTo([levels.toLevel("FATAL")]);
|
assertThat(fatal).isEqualTo([levels.toLevel("FATAL")]);
|
||||||
assertThat(fatal).isNotEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.OFF]);
|
assertThat(fatal).isNotEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.OFF
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'OFF': {
|
'OFF': {
|
||||||
topic: levels.OFF,
|
topic: levels.OFF,
|
||||||
'should not be less than anything': function(off) {
|
'should not be less than anything': function(off) {
|
||||||
assertThat(off).isNotLessThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL]);
|
assertThat(off).isNotLessThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should be greater than everything': function(off) {
|
'should be greater than everything': function(off) {
|
||||||
assertThat(off).isGreaterThanOrEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL]);
|
assertThat(off).isGreaterThanOrEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
'should only be equal to OFF': function(off) {
|
'should only be equal to OFF': function(off) {
|
||||||
assertThat(off).isEqualTo([levels.toLevel("OFF")]);
|
assertThat(off).isEqualTo([levels.toLevel("OFF")]);
|
||||||
assertThat(off).isNotEqualTo([levels.ALL, levels.TRACE, levels.DEBUG, levels.INFO, levels.WARN, levels.ERROR, levels.FATAL]);
|
assertThat(off).isNotEqualTo([
|
||||||
|
levels.ALL,
|
||||||
|
levels.TRACE,
|
||||||
|
levels.DEBUG,
|
||||||
|
levels.INFO,
|
||||||
|
levels.WARN,
|
||||||
|
levels.ERROR,
|
||||||
|
levels.FATAL
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user