source: trip-planner-front/node_modules/loglevel/test/get-current-level-test.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1"use strict";
2
3define(['test/test-helpers'], function(testHelpers) {
4 var describeIf = testHelpers.describeIf;
5 var it = testHelpers.itWithFreshLog;
6
7 var originalConsole = window.console;
8
9 describe("Setting default log level tests:", function() {
10
11 beforeEach(function() {
12 window.console = {"log" : jasmine.createSpy("console.log")};
13 });
14
15 afterEach(function() {
16 window.console = originalConsole;
17 });
18
19 describe("If no level is saved", function() {
20 it("current level is the default level", function(log) {
21 log.setDefaultLevel("trace");
22 expect(log.getLevel()).toBe(log.levels.TRACE);
23 });
24 });
25
26 describe("If a level is saved", function () {
27 beforeEach(function () {
28 testHelpers.setStoredLevel("trace");
29 });
30
31 it("current level is the level which has been saved", function (log) {
32 log.setDefaultLevel("debug");
33 expect(log.getLevel()).toBe(log.levels.TRACE);
34 });
35 });
36
37 describe("If the level is stored incorrectly", function() {
38 beforeEach(function() {
39 testHelpers.setLocalStorageStoredLevel("gibberish");
40 });
41
42 it("current level is the default level", function(log) {
43 log.setDefaultLevel("debug");
44 expect(log.getLevel()).toBe(log.levels.DEBUG);
45 });
46 });
47 });
48});
Note: See TracBrowser for help on using the repository browser.