mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-10-09 13:57:21 +00:00
Moves 290 root test-*.js into tests/unit (177, listed in test-all.sh) and tests/e2e (113, classified in scripts/non-unit-tests.json), per #1981 and PR-D of #1385. Root goes from 348 entries to 48. test-all.sh and test-fixtures/ stay put. The inventory guard now fails if a test reappears in the root or sits in the wrong folder.
Verified independently of the diff: the invoked sets are unchanged (test-all.sh 177 before and after, deploy.yml 96 before and after, both identical as sets), and a full local run of test-all.sh on master and on the branch produced 4702 output lines each whose only differences are absolute paths, stack-trace line numbers shifted by the REPO_ROOT line, the inventory wording and two perf ratios. The guard was mutation-checked: a test back in the root, a unit suite in tests/e2e, and a suite dropped from test-all.sh each make it exit 1. CI run 35246304316 ran 97 suites from tests/e2e and is green.
Follow-up 9335c51d finished the instruction files: no bare root test command is left in AGENTS.md, the squad charters, .github or docs, and every tests/ path they name resolves.
Merged by the interim maintainer without a second human reviewer: CI and the local runs above are the independent checks.
Known and deliberately out of scope: 18 of the 113 files in tests/e2e are invoked by no runner at all, and one of them cannot run anywhere because it requires jsdom, which is not a declared dependency. Tracked separately.
67 lines
2.4 KiB
JavaScript
67 lines
2.4 KiB
JavaScript
/**
|
|
* #1846 — Observers page pinned to 1200px on wide screens; columns crushed
|
|
* while responsive auto-hide has already fired for narrow widths.
|
|
*
|
|
* Root cause: public/style.css `.observers-page { max-width: 1200px; }`
|
|
* caps a column-dense table at 1200px, leaving unused space on wide
|
|
* monitors while narrow viewports still trigger data-priority column
|
|
* auto-hide.
|
|
*
|
|
* Fix: drop the narrow cap on `.observers-page`. Either remove `max-width`
|
|
* entirely (preferred — let the browser use available width) or raise it
|
|
* to a value >= 1600px (matches `.analytics-page` convention).
|
|
*
|
|
* This is a regression guard: a future author must not re-introduce a
|
|
* narrow (<1600px) `max-width` on `.observers-page` without deleting or
|
|
* updating this test.
|
|
*/
|
|
'use strict';
|
|
const REPO_ROOT = require('path').resolve(__dirname, '..', '..');
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const css = fs.readFileSync(path.join(REPO_ROOT, 'public', 'style.css'), 'utf8');
|
|
|
|
let passed = 0, failed = 0;
|
|
function assert(cond, msg) {
|
|
if (cond) { passed++; console.log(' ok ', msg); }
|
|
else { failed++; console.log(' FAIL', msg); }
|
|
}
|
|
|
|
console.log('# #1846 observers-page width regression guard');
|
|
|
|
// Match the .observers-page block (single-line rule).
|
|
// e.g. ".observers-page { padding: 20px; max-width: 1200px; margin: 0 auto; }"
|
|
const re = /\.observers-page\s*\{([^}]*)\}/g;
|
|
const blocks = [];
|
|
let m;
|
|
while ((m = re.exec(css)) !== null) blocks.push(m[1]);
|
|
|
|
assert(blocks.length > 0, `.observers-page rule exists in public/style.css (found ${blocks.length})`);
|
|
|
|
for (const body of blocks) {
|
|
const mw = body.match(/max-width\s*:\s*([^;]+);?/i);
|
|
if (!mw) {
|
|
assert(true, `.observers-page has no narrow max-width cap`);
|
|
continue;
|
|
}
|
|
const val = mw[1].trim();
|
|
// Allowlist: none / unset / initial / a length >= 1600px.
|
|
if (/^(none|unset|initial|revert)$/i.test(val)) {
|
|
assert(true, `.observers-page max-width is ${val} (uncapped)`);
|
|
continue;
|
|
}
|
|
const pxMatch = val.match(/^(\d+(?:\.\d+)?)px$/i);
|
|
if (pxMatch) {
|
|
const px = parseFloat(pxMatch[1]);
|
|
assert(px >= 1600, `.observers-page max-width ${val} must be >= 1600px (matches .analytics-page convention) — see #1846`);
|
|
continue;
|
|
}
|
|
// Non-px unit (e.g. %, vw) — accept, hard to reason about.
|
|
assert(true, `.observers-page max-width is non-px (${val}) — accepted`);
|
|
}
|
|
|
|
console.log(`\n# ${passed} passed, ${failed} failed`);
|
|
process.exit(failed === 0 ? 0 : 1);
|