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.

currentweather_spec.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* eslint no-multi-spaces: 0 */
  2. describe("Functions module currentweather", function () {
  3. // Fake for use by currentweather.js
  4. Module = {};
  5. config = {};
  6. Module.definitions = {};
  7. Module.register = function (name, moduleDefinition) {
  8. Module.definitions[name] = moduleDefinition;
  9. };
  10. beforeAll(function () {
  11. require("../../../modules/default/currentweather/currentweather.js");
  12. Module.definitions.currentweather.config = {};
  13. });
  14. describe("roundValue", function () {
  15. describe("this.config.roundTemp is true", function () {
  16. beforeAll(function () {
  17. Module.definitions.currentweather.config.roundTemp = true;
  18. });
  19. const values = [
  20. // index 0 value
  21. // index 1 expect
  22. [1, "1"],
  23. [1.0, "1"],
  24. [1.02, "1"],
  25. [10.12, "10"],
  26. [2.0, "2"],
  27. ["2.12", "2"],
  28. [10.1, "10"]
  29. ];
  30. values.forEach((value) => {
  31. it(`for ${value[0]} should be return ${value[1]}`, function () {
  32. expect(Module.definitions.currentweather.roundValue(value[0])).toBe(value[1]);
  33. });
  34. });
  35. });
  36. describe("this.config.roundTemp is false", function () {
  37. beforeAll(function () {
  38. Module.definitions.currentweather.config.roundTemp = false;
  39. });
  40. const values = [
  41. // index 0 value
  42. // index 1 expect
  43. [1, "1.0"],
  44. [1.0, "1.0"],
  45. [1.02, "1.0"],
  46. [10.12, "10.1"],
  47. [2.0, "2.0"],
  48. ["2.12", "2.1"],
  49. [10.1, "10.1"],
  50. [10.1, "10.1"]
  51. ];
  52. values.forEach((value) => {
  53. it(`for ${value[0]} should be return ${value[1]}`, function () {
  54. expect(Module.definitions.currentweather.roundValue(value[0])).toBe(value[1]);
  55. });
  56. });
  57. });
  58. });
  59. });