Import tests: test/encoding
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
|
||||
const root = path.join(__dirname, "..");
|
||||
const files = [
|
||||
"manifest.json",
|
||||
"README.md",
|
||||
"demo.html",
|
||||
"src/content.js",
|
||||
"popup/popup.html",
|
||||
"popup/popup.js",
|
||||
"test/content-engine.js",
|
||||
"test/edge-cases.js"
|
||||
];
|
||||
const mojibakeMarkers = ["\u00D8\u00A7", "\u00D9\u0085", "\u00E2\u20AC", "\u00C3\u0097"];
|
||||
|
||||
for (const file of files) {
|
||||
const text = fs.readFileSync(path.join(root, file), "utf8");
|
||||
for (const marker of mojibakeMarkers) {
|
||||
assert.equal(text.includes(marker), false, `${file} contains a mojibake marker`);
|
||||
}
|
||||
}
|
||||
|
||||
const fixtures = fs.readFileSync(path.join(root, "test/content-engine.js"), "utf8");
|
||||
assert.match(fixtures, /[پچژگکی]/, "tests must contain real Persian-specific characters");
|
||||
|
||||
const manifest = JSON.parse(fs.readFileSync(path.join(root, "manifest.json"), "utf8"));
|
||||
assert.match(manifest.name, /Persian/);
|
||||
assert.doesNotMatch(manifest.name, /Arabic/);
|
||||
assert.equal(manifest.content_scripts[0].match_origin_as_fallback, true);
|
||||
|
||||
console.log("Encoding and manifest checks passed");
|
||||
Reference in New Issue
Block a user