Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

default-level-test.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. "use strict";
  2. define(['test/test-helpers'], function(testHelpers) {
  3. var describeIf = testHelpers.describeIf;
  4. var it = testHelpers.itWithFreshLog;
  5. var originalConsole = window.console;
  6. describe("Setting default log level tests:", function() {
  7. beforeEach(function() {
  8. window.console = {"log" : jasmine.createSpy("console.log")};
  9. this.addMatchers({
  10. "toBeAtLevel" : testHelpers.toBeAtLevel,
  11. "toBeTheStoredLevel" : testHelpers.toBeTheLevelStoredByLocalStorage
  12. });
  13. testHelpers.clearStoredLevels();
  14. });
  15. afterEach(function() {
  16. window.console = originalConsole;
  17. });
  18. describe("If no level is saved", function() {
  19. it("new level is always set", function(log) {
  20. log.setDefaultLevel("trace");
  21. expect(log).toBeAtLevel("trace");
  22. });
  23. it("level is not persisted", function(log) {
  24. log.setDefaultLevel("debug");
  25. expect("debug").not.toBeTheStoredLevel();
  26. });
  27. });
  28. describe("If a level is saved", function () {
  29. beforeEach(function () {
  30. testHelpers.setStoredLevel("trace");
  31. });
  32. it("saved level is not modified", function (log) {
  33. log.setDefaultLevel("debug");
  34. expect(log).toBeAtLevel("trace");
  35. });
  36. });
  37. describe("If the level is stored incorrectly", function() {
  38. beforeEach(function() {
  39. testHelpers.setLocalStorageStoredLevel("gibberish");
  40. });
  41. it("new level is set", function(log) {
  42. log.setDefaultLevel("debug");
  43. expect(log).toBeAtLevel("debug");
  44. expect("debug").not.toBeTheStoredLevel();
  45. });
  46. });
  47. });
  48. });