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 () { describe("All font files from roboto.css should be downloadable", function () {
helpers.setupTimeout(this); helpers.setupTimeout(this);
var app; let app;
var fontFiles = []; const fontFiles = [];
// Statements below filters out all 'url' lines in the CSS file // Statements below filters out all 'url' lines in the CSS file
var fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8"); const fileContent = require("fs").readFileSync(__dirname + "/../../fonts/roboto.css", "utf8");
var regex = /\burl\(['"]([^'"]+)['"]\)/g; const regex = /\burl\(['"]([^'"]+)['"]\)/g;
var match = regex.exec(fileContent); let match = regex.exec(fileContent);
while (match !== null) { while (match !== null) {
// Push 1st match group onto fontFiles stack // Push 1st match group onto fontFiles stack
fontFiles.push(match[1]); 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) => { 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) => { fetch(fontUrl).then((res) => {
expect(res.status).to.equal(200); expect(res.status).to.equal(200);
done(); done();