feat: add multilingual interface support
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
const root = path.resolve(__dirname, "..");
|
||||
|
||||
test("the Docker image includes every application script referenced by the page", () => {
|
||||
const html = fs.readFileSync(path.join(root, "index.html"), "utf8");
|
||||
const dockerfile = fs.readFileSync(path.join(root, "Dockerfile"), "utf8");
|
||||
const applicationScripts = [...html.matchAll(/<script src="\.\/([^"]+\.js)"/g)]
|
||||
.map((match) => match[1])
|
||||
.filter((scriptPath) => !scriptPath.startsWith("vendor/"));
|
||||
|
||||
assert.ok(applicationScripts.length > 0);
|
||||
applicationScripts.forEach((scriptPath) => {
|
||||
assert.ok(fs.existsSync(path.join(root, scriptPath)), `${scriptPath} must exist`);
|
||||
assert.match(
|
||||
dockerfile,
|
||||
new RegExp(`^COPY ${scriptPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} \\.\\/$`, "m"),
|
||||
`${scriptPath} must be copied by the Dockerfile`,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user