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.

utils_spec.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. const Utils = require("../../../js/utils.js");
  2. const colors = require("colors/safe");
  3. describe("Utils", function () {
  4. describe("colors", function () {
  5. const colorsEnabled = colors.enabled;
  6. afterEach(function () {
  7. colors.enabled = colorsEnabled;
  8. });
  9. it("should have info, warn and error properties", function () {
  10. expect(Utils.colors).toHaveProperty("info");
  11. expect(Utils.colors).toHaveProperty("warn");
  12. expect(Utils.colors).toHaveProperty("error");
  13. });
  14. it("properties should be functions", function () {
  15. expect(typeof Utils.colors.info).toBe("function");
  16. expect(typeof Utils.colors.warn).toBe("function");
  17. expect(typeof Utils.colors.error).toBe("function");
  18. });
  19. it("should print colored message in supported consoles", function () {
  20. colors.enabled = true;
  21. expect(Utils.colors.info("some informations")).toBe("\u001b[34msome informations\u001b[39m");
  22. expect(Utils.colors.warn("a warning")).toBe("\u001b[33ma warning\u001b[39m");
  23. expect(Utils.colors.error("ERROR!")).toBe("\u001b[31mERROR!\u001b[39m");
  24. });
  25. it("should print message in unsupported consoles", function () {
  26. colors.enabled = false;
  27. expect(Utils.colors.info("some informations")).toBe("some informations");
  28. expect(Utils.colors.warn("a warning")).toBe("a warning");
  29. expect(Utils.colors.error("ERROR!")).toBe("ERROR!");
  30. });
  31. });
  32. });