« get me outta code hell

test: update & fix-up image snapshot tests - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-04 20:48:54 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-04 20:55:54 -0300
commitd194fc4f537ee79b0558b54ff2e1fdc3e9cbf4d9 (patch)
treef6f4f4338e074e31f0adaa8fcbdb0ca631e69b66 /test/snapshot
parent63d9b8c2d455e2f74a837d8772fcfcf8e38e3a3e (diff)
test: update & fix-up image snapshot tests
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/image.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/snapshot/image.js b/test/snapshot/image.js
index 48dcfb6..8608ab6 100644
--- a/test/snapshot/image.js
+++ b/test/snapshot/image.js
@@ -4,15 +4,17 @@ import {testContentFunctions} from '#test-lib';
 testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
   await evaluate.load();
 
-  const quickSnapshot = (message, opts) =>
+  const quickSnapshot = (message, {extraDependencies, ...opts}) =>
     evaluate.snapshot(message, {
       name: 'image',
       extraDependencies: {
+        checkIfImagePathHasCachedThumbnails: path => !path.endsWith('.gif'),
         getSizeOfImagePath: () => 0,
         getDimensionsOfImagePath: () => [600, 600],
         getThumbnailEqualOrSmaller: () => 'medium',
         getThumbnailsAvailableForDimensions: () =>
           [['large', 800], ['medium', 400], ['small', 250]],
+        ...extraDependencies,
       },
       ...opts,
     });
@@ -106,6 +108,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
   evaluate.snapshot('thumbnail details', {
     name: 'image',
     extraDependencies: {
+      checkIfImagePathHasCachedThumbnails: () => true,
       getSizeOfImagePath: () => 0,
       getDimensionsOfImagePath: () => [900, 1200],
       getThumbnailsAvailableForDimensions: () =>
@@ -117,4 +120,11 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
       path: ['media.albumCover', 'beyond-canon', 'png'],
     },
   });
+
+  quickSnapshot('thumb requested but source is gif', {
+    slots: {
+      thumb: 'medium',
+      path: ['media.flashArt', '5426', 'gif'],
+    },
+  });
 });