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.

cmp_versions_spec.js 867B

12345678910111213141516171819202122232425262728293031
  1. const path = require("path");
  2. const { JSDOM } = require("jsdom");
  3. describe("Test function cmpVersions in js/module.js", function () {
  4. let cmp;
  5. beforeAll(function (done) {
  6. const dom = new JSDOM(
  7. `<script>var Class = {extend: function() { return {}; }};</script>\
  8. <script src="file://${path.join(__dirname, "..", "..", "..", "js", "module.js")}">`,
  9. { runScripts: "dangerously", resources: "usable" }
  10. );
  11. dom.window.onload = function () {
  12. const { cmpVersions } = dom.window;
  13. cmp = cmpVersions;
  14. done();
  15. };
  16. });
  17. it("should return -1 when comparing 2.1 to 2.2", function () {
  18. expect(cmp("2.1", "2.2")).toBe(-1);
  19. });
  20. it("should be return 0 when comparing 2.2 to 2.2", function () {
  21. expect(cmp("2.2", "2.2")).toBe(0);
  22. });
  23. it("should be return 1 when comparing 1.1 to 1.0", function () {
  24. expect(cmp("1.1", "1.0")).toBe(1);
  25. });
  26. });