source: trip-planner-front/node_modules/loglevel/test/integration-smoke-test.js@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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