add oled.css to build test

This commit is contained in:
hgw 2023-12-03 03:38:40 +00:00
parent 747107169b
commit 89cbc770de
Signed by: hgw
SSH Key Fingerprint: SHA256:diG7RVYHjd3aDYkZWHYcBJbImu+6zfptuUP+3k/wol4

View File

@ -1,4 +1,4 @@
import {expect} from "chai";
import { expect } from "chai";
import fs from "fs";
import path from "path";
@ -6,68 +6,102 @@ describe("public folder", function () {
const publicFolder = path.join(__dirname, "..", "..", "public");
it("font awesome files are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "fonts", "fa-solid-900.woff"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "fonts", "fa-solid-900.woff2"))).to.be.true;
expect(
fs.existsSync(path.join(publicFolder, "fonts", "fa-solid-900.woff"))
).to.be.true;
expect(
fs.existsSync(
path.join(publicFolder, "fonts", "fa-solid-900.woff2")
)
).to.be.true;
});
it("files in root folder are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "favicon.ico"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "favicon.ico"))).to.be
.true;
expect(fs.existsSync(path.join(publicFolder, "robots.txt"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "service-worker.js"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "service-worker.js"))).to
.be.true;
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest")))
.to.be.true;
});
it("audio files are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "audio", "pop.wav"))).to.be.true;
});
it("index HTML file is not copied", function () {
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be.false;
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be.false;
});
it("javascript files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.vendor.js"))).to.be.true;
});
it("style files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "default.css"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "morning.css"))).to.be.true;
});
it("style files contain expected content", function (done) {
fs.readFile(path.join(publicFolder, "css", "style.css"), "utf8", function (err, contents) {
expect(err).to.be.null;
expect(contents.includes("var(--body-color)")).to.be.true;
expect(contents.includes("url(../fonts/fa-solid-900.woff2)")).to.be.true;
expect(contents.includes(".tooltipped{position:relative}")).to.be.true;
expect(contents.includes("sourceMappingURL")).to.be.true;
done();
});
});
it("javascript map is created", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js.map"))).to.be.true;
});
it("loading-error-handlers.js is copied", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
expect(fs.existsSync(path.join(publicFolder, "audio", "pop.wav"))).to.be
.true;
});
it("index HTML file is not copied", function () {
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be
.false;
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be
.false;
});
it("javascript files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js"))).to.be
.true;
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.vendor.js")))
.to.be.true;
});
it("style files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be
.true;
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map")))
.to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "default.css")))
.to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "morning.css")))
.to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "oled.css"))).to
.be.true;
});
it("style files contain expected content", function (done) {
fs.readFile(
path.join(publicFolder, "css", "style.css"),
"utf8",
function (err, contents) {
expect(err).to.be.null;
expect(contents.includes("var(--body-color)")).to.be.true;
expect(contents.includes("url(../fonts/fa-solid-900.woff2)")).to
.be.true;
expect(contents.includes(".tooltipped{position:relative}")).to
.be.true;
expect(contents.includes("sourceMappingURL")).to.be.true;
done();
}
);
});
it("javascript map is created", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "bundle.js.map"))).to
.be.true;
});
it("loading-error-handlers.js is copied", function () {
expect(
fs.existsSync(
path.join(publicFolder, "js", "loading-error-handlers.js")
)
).to.be.true;
});
it("service worker has cacheName set", function (done) {
fs.readFile(path.join(publicFolder, "service-worker.js"), "utf8", function (err, contents) {
fs.readFile(
path.join(publicFolder, "service-worker.js"),
"utf8",
function (err, contents) {
expect(err).to.be.null;
expect(contents.includes("const cacheName")).to.be.true;
expect(contents.includes("__HASH__")).to.be.false;
done();
});
}
);
});
});