Skip to content

Commit 3f55650

Browse files
committed
fix(test): verify product page repair semantically
1 parent b7fb59d commit 3f55650

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

scripts/maintenance.test.mjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ function runCommand(cwd, args) {
4444
});
4545
}
4646

47-
function normalizeMarkup(value) {
48-
return value.replace(/\s+/g, " ").trim();
49-
}
50-
5147
{
5248
const fixture = makeFixture();
5349
run(fixture, [
@@ -237,9 +233,15 @@ function normalizeMarkup(value) {
237233
);
238234

239235
runCommand(fixture, ["scripts/v8s-fix", "--product-pages"]);
236+
const fixedStatsHtml = fs.readFileSync(statsPath, "utf8");
237+
assert.doesNotMatch(fixedStatsHtml, /Old dashboard/);
238+
assert.match(fixedStatsHtml, /id="metrics"/);
239+
assert.match(fixedStatsHtml, /href="api\/v8s\.json"/);
240+
241+
const fixedDoctorJson = JSON.parse(run(fixture, ["scripts/doctor.mjs", "--json"]));
240242
assert.equal(
241-
normalizeMarkup(fs.readFileSync(statsPath, "utf8")),
242-
normalizeMarkup(fs.readFileSync(path.join(fixture, "defaults", "public", "_stats", "index.html"), "utf8"))
243+
fixedDoctorJson.issues.some((issue) => issue.path === "custom/public/_stats/index.html"),
244+
false
243245
);
244246
}
245247

0 commit comments

Comments
 (0)