« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/lib/content-function.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/content-function.js')
-rw-r--r--test/lib/content-function.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/lib/content-function.js b/test/lib/content-function.js
index be76c31d..a46d18c9 100644
--- a/test/lib/content-function.js
+++ b/test/lib/content-function.js
@@ -17,8 +17,23 @@ import mock from './generic-mock.js';
 
 const __dirname = path.dirname(fileURLToPath(import.meta.url));
 
+function cleanURLSpec(reference) {
+  const prepared = structuredClone(reference);
+
+  for (const spec of Object.values(prepared)) {
+    if (spec.prefix) {
+      // Strip out STATIC_VERSION. This updates fairly regularly and we
+      // don't want it to affect snapshot tests.
+      spec.prefix = spec.prefix
+        .replace(/static-\d+[a-z]\d+/i, 'static');
+    }
+  }
+
+  return prepared;
+}
+
 export function testContentFunctions(t, message, fn) {
-  const urls = generateURLs(urlSpec);
+  const urls = generateURLs(cleanURLSpec(urlSpec));
 
   t.test(message, async t => {
     let loadedContentDependencies;