diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-01 00:06:58 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-01 00:06:58 -0300 |
commit | aeba505f7e791eae57e80603ad3b4ab1ab764e96 (patch) | |
tree | 3e43496b6a4113afb56e9a0f42739205acf13388 | |
parent | 401236648e1efe907798dd4e2d368f1fbc773b62 (diff) |
test: extract STATIC_VERSION from affecting tests
-rw-r--r-- | test/lib/content-function.js | 17 |
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; |