integration-smoke-test.js
2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"use strict";
define(['../lib/loglevel', 'test/test-helpers'], function(log, testHelpers) {
var describeIf = testHelpers.describeIf;
var itIf = testHelpers.itIf;
describe("Integration smoke tests:", function() {
describe("log methods", function() {
it("can all be disabled", function() {
log.setLevel(log.levels.SILENT);
log.trace("trace");
log.debug("debug");
log.log("log");
log.info("info");
log.warn("warn");
log.error("error");
});
});
describeIf(typeof console !== "undefined", "log methods", function() {
it("can all be called", function() {
if (typeof console !== "undefined") {
log.setLevel(log.levels.TRACE);
}
log.trace("trace");
log.debug("debug");
log.log("log");
log.info("info");
log.warn("warn");
log.error("error");
});
});
describeIf(typeof console !== "undefined", "log levels", function() {
beforeEach(function() {
this.addMatchers({
"toBeTheStoredLevel" : testHelpers.toBeTheStoredLevel
});
});
it("are all settable", function() {
log.setLevel(log.levels.TRACE);
log.setLevel(log.levels.DEBUG);
log.setLevel(log.levels.INFO);
log.setLevel(log.levels.WARN);
log.setLevel(log.levels.ERROR);
});
itIf(testHelpers.isAnyLevelStoragePossible(), "are persisted", function() {
log.setLevel(log.levels.TRACE);
expect('trace').toBeTheStoredLevel();
log.setLevel(log.levels.DEBUG);
expect('debug').toBeTheStoredLevel();
log.setLevel(log.levels.INFO);
expect('info').toBeTheStoredLevel();
log.setLevel(log.levels.WARN);
expect('warn').toBeTheStoredLevel();
log.setLevel(log.levels.ERROR);
expect('error').toBeTheStoredLevel();
log.setLevel(log.levels.SILENT);
expect('silent').toBeTheStoredLevel();
});
});
});
});