test-qunit.js 1.8 KB

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