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.

fonts.js 986B

12345678910111213141516171819202122232425262728293031
  1. const fetch = require("node-fetch");
  2. const helpers = require("./global-setup");
  3. describe("All font files from roboto.css should be downloadable", function () {
  4. const fontFiles = [];
  5. // Statements below filters out all 'url' lines in the CSS file
  6. const fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
  7. const regex = /\burl\(['"]([^'"]+)['"]\)/g;
  8. let match = regex.exec(fileContent);
  9. while (match !== null) {
  10. // Push 1st match group onto fontFiles stack
  11. fontFiles.push(match[1]);
  12. // Find the next one
  13. match = regex.exec(fileContent);
  14. }
  15. beforeAll(function () {
  16. helpers.startApplication("tests/configs/without_modules.js");
  17. });
  18. afterAll(function () {
  19. helpers.stopApplication();
  20. });
  21. test.each(fontFiles)("should return 200 HTTP code for file '%s'", (fontFile, done) => {
  22. const fontUrl = "http://localhost:8080/fonts/" + fontFile;
  23. fetch(fontUrl).then((res) => {
  24. expect(res.status).toBe(200);
  25. done();
  26. });
  27. });
  28. });