source: trip-planner-front/node_modules/loglevel/test/node-integration.js@ eed0bf8

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

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1"use strict";
2
3describe("loglevel included via node", function () {
4 it("is included successfully", function () {
5 expect(require('../lib/loglevel')).not.toBeUndefined();
6 });
7
8 it("allows setting the logging level", function () {
9 var log = require('../lib/loglevel');
10
11 log.setLevel(log.levels.TRACE);
12 log.setLevel(log.levels.DEBUG);
13 log.setLevel(log.levels.INFO);
14 log.setLevel(log.levels.WARN);
15 log.setLevel(log.levels.ERROR);
16 });
17
18 it("successfully logs", function () {
19 var log = require('../lib/loglevel');
20 console.info = jasmine.createSpy("info");
21
22 log.setLevel(log.levels.INFO);
23 log.info("test message");
24
25 expect(console.info).toHaveBeenCalledWith("test message");
26 });
27
28 it("supports using symbols as names", function() {
29 var log = require('../lib/loglevel');
30
31 var s1 = Symbol("a-symbol");
32 var s2 = Symbol("a-symbol");
33
34 var logger1 = log.getLogger(s1);
35 var defaultLevel = logger1.getLevel();
36 logger1.setLevel(log.levels.TRACE);
37
38 var logger2 = log.getLogger(s2);
39
40 // Should be unequal: same name, but different symbol instances
41 expect(logger1).not.toEqual(logger2);
42 expect(logger2.getLevel()).toEqual(defaultLevel);
43 });
44});
Note: See TracBrowser for help on using the repository browser.