« get me outta code hell

test: snapshot how thumbnail details are exposed in images - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-30 10:01:00 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-01 14:06:15 -0300
commit145a4a292dea7dccb2bb9b58a760db32948c3918 (patch)
treeccd4c670f354ea97350a2e0bcbda79f0964695a8
parent029210cc329a015a939472a688209d3f3423242b (diff)
test: snapshot how thumbnail details are exposed in images
-rw-r--r--tap-snapshots/test/snapshot/image.js.test.cjs4
-rw-r--r--test/snapshot/image.js15
2 files changed, 19 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/image.js.test.cjs b/tap-snapshots/test/snapshot/image.js.test.cjs
index e451e1d5..bee117e1 100644
--- a/tap-snapshots/test/snapshot/image.js.test.cjs
+++ b/tap-snapshots/test/snapshot/image.js.test.cjs
@@ -55,6 +55,10 @@ exports[`test/snapshot/image.js TAP image (snapshot) > square 1`] = `
 <div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img></div></div></div></div>
 `
 
+exports[`test/snapshot/image.js TAP image (snapshot) > thumbnail details 1`] = `
+<div class="image-container"><div class="image-inner-area"><img data-original-length="1200" data-thumbs="voluminous:1200 middling:900 petite:20" src="media/album-art/beyond-canon/cover.voluminous.jpg"></div></div>
+`
+
 exports[`test/snapshot/image.js TAP image (snapshot) > width & height 1`] = `
 <div class="image-container"><div class="image-inner-area"><img width="600" height="400"></div></div>
 `
diff --git a/test/snapshot/image.js b/test/snapshot/image.js
index 5e12cc25..a8796e11 100644
--- a/test/snapshot/image.js
+++ b/test/snapshot/image.js
@@ -98,4 +98,19 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
       path: ['media.albumCover', 'beyond-canon', 'png'],
     },
   });
+
+  evaluate.snapshot('thumbnail details', {
+    name: 'image',
+    extraDependencies: {
+      getSizeOfImagePath: () => 0,
+      getDimensionsOfImagePath: () => [900, 1200],
+      getThumbnailsAvailableForDimensions: () =>
+        [['voluminous', 1200], ['middling', 900], ['petite', 20]],
+      getThumbnailEqualOrSmaller: () => 'voluminous',
+    },
+    slots: {
+      thumb: 'gargantuan',
+      path: ['media.albumCover', 'beyond-canon', 'png'],
+    },
+  });
 });