UNPKG

1.94 kBJavaScriptView Raw
1"use strict";
2
3/*global document*/
4var fixture = document.getElementById("qunit-fixture");
5
6/*global QUnit*/
7QUnit.module('loglevel', {
8 setup: function() {
9 },
10 teardown: function() {
11 }
12});
13
14/*global test*/
15test('basic test', function() {
16 /*global ok*/
17 /*global logging*/
18 /*global log*/
19
20 // Check that noConflict restored the original log
21 ok(typeof log === "function", "log is a function");
22 ok(log === QUnit.log, "log is Qunit.log");
23
24 // Check that noConflict setup logging
25 ok(typeof logging !== "undefined", "logging is defined");
26 ok(typeof logging === "object", "logging is an object");
27 ok(typeof logging.trace === "function", "trace is a function");
28 ok(typeof logging.debug === "function", "debug is a function");
29 ok(typeof logging.info === "function", "info is a function");
30 ok(typeof logging.warn === "function", "warn is a function");
31 ok(typeof logging.error === "function", "error is a function");
32 ok(typeof logging.setLevel === "function", "setLevel is a function");
33 ok(typeof logging.setDefaultLevel === "function", "setDefaultLevel is a function");
34 ok(typeof logging.enableAll === "function", "enableAll is a function");
35 ok(typeof logging.disableAll === "function", "disableAll is a function");
36 ok(typeof logging.getLogger === "function", "getLogger is a function");
37
38 // Use the API to make sure it doesn't blantantly fail with exceptions
39 logging.trace("a trace message");
40 logging.debug("a debug message");
41 logging.info("an info message");
42 logging.warn("a warn message");
43 logging.error("an error message");
44
45 var newLogger = logging.getLogger("newLogger");
46 newLogger.trace("a trace message");
47 newLogger.debug("a debug message");
48 newLogger.info("an info message");
49 newLogger.warn("a warn message");
50 newLogger.error("an error message");
51});