aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/test-app-util.mjs
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-20 16:33:36 -0400
committerCraig Jennings <c@cjennings.net>2026-06-20 16:33:36 -0400
commit497cd2bfd83131eb68a8b7f6299af810584b1f5a (patch)
tree7b2edc0a65ae1313fdb072d4a59b35deb8f1b085 /scripts/theme-studio/test-app-util.mjs
parentbe93d96a6ef7882e6871627c5e3585852a80dd0f (diff)
downloaddotemacs-497cd2bfd83131eb68a8b7f6299af810584b1f5a.tar.gz
dotemacs-497cd2bfd83131eb68a8b7f6299af810584b1f5a.zip
refactor(theme-studio): dedup the inline-integrity test scaffolding
Two test-DRY cleanups. The seven near-identical test_page_carries_*_verbatim methods in test_generate.py collapse into one subTest loop over the inlined-body names. The strip-exports helper -- reimplemented three times across the colormath, app-core, and app-util inline-integrity tests, each annotated 'same strip generate.py applies' -- moves to one shared inline-strip.mjs (stripInlinedBody), so the three copies can no longer drift from generate.py's strip_exports.
Diffstat (limited to 'scripts/theme-studio/test-app-util.mjs')
-rw-r--r--scripts/theme-studio/test-app-util.mjs6
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/theme-studio/test-app-util.mjs b/scripts/theme-studio/test-app-util.mjs
index 37cf0889b..057f55f8d 100644
--- a/scripts/theme-studio/test-app-util.mjs
+++ b/scripts/theme-studio/test-app-util.mjs
@@ -84,12 +84,10 @@ test('textOn: Boundary — straddles the ~0.179 luminance crossover', () => {
// Inline-integrity: the page must carry app-util.js's body (sans import/export)
// verbatim — the same strip generate.py applies. Requires `python3 generate.py`.
-const stripModule = (s) =>
- s.split('\n').filter((l) => !(l.startsWith('export') || l.startsWith('import')))
- .join('\n').replace(/\s+$/, '');
+import { stripInlinedBody } from './inline-strip.mjs';
test('inline-integrity: theme-studio.html contains the app-util.js body verbatim', () => {
- const body = stripModule(readFileSync(here + 'app-util.js', 'utf8'));
+ const body = stripInlinedBody(readFileSync(here + 'app-util.js', 'utf8'));
const html = readFileSync(here + 'theme-studio.html', 'utf8');
assert.ok(html.includes(body), 'generated page is missing the app-util.js body verbatim');
});