Use es6 notation in font tests

This commit is contained in:
rejas 2021-03-17 22:34:32 +01:00
parent ef2ff50089
commit 7f1a3df25b

View File

@ -8,12 +8,12 @@ const describe = global.describe;
describe("All font files from roboto.css should be downloadable", function () {
helpers.setupTimeout(this);
var app;
var fontFiles = [];
let app;
const fontFiles = [];
// Statements below filters out all 'url' lines in the CSS file
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
var regex = /\burl\(['"]([^'"]+)['"]\)/g;
var match = regex.exec(fileContent);
const fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
const regex = /\burl\(['"]([^'"]+)['"]\)/g;
let match = regex.exec(fileContent);
while (match !== null) {
// Push 1st match group onto fontFiles stack
fontFiles.push(match[1]);
@ -39,7 +39,7 @@ describe("All font files from roboto.css should be downloadable", function () {
});
forEach(fontFiles).it("should return 200 HTTP code for file '%s'", (fontFile, done) => {
var fontUrl = "http://localhost:8080/fonts/" + fontFile;
const fontUrl = "http://localhost:8080/fonts/" + fontFile;
fetch(fontUrl).then((res) => {
expect(res.status).to.equal(200);
done();