« get me outta code hell

test: image: supply & test missingImagePaths - 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-09-24 10:01:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-24 10:01:14 -0300
commit243af63c1ca36343f780b6e95b05493ff03ca68b (patch)
treed24c5717167250ff6ac350dc83bf1b03eed40a32
parenta53d53e1f95d84b23cffb9a5d43f1a70a412b6fe (diff)
test: image: supply & test missingImagePaths
-rw-r--r--tap-snapshots/test/snapshot/image.js.test.cjs8
-rw-r--r--test/snapshot/image.js18
2 files changed, 26 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/image.js.test.cjs b/tap-snapshots/test/snapshot/image.js.test.cjs
index d87ab714..3cd1a317 100644
--- a/tap-snapshots/test/snapshot/image.js.test.cjs
+++ b/tap-snapshots/test/snapshot/image.js.test.cjs
@@ -39,6 +39,14 @@ exports[`test/snapshot/image.js TAP image (snapshot) > link with file size 1`] =
 <a class="box image-link" href="media/album-art/pingas/cover.png"><div class="image-container"><div class="image-inner-area"><img src="media/album-art/pingas/cover.png"></div></div></a>
 `
 
+exports[`test/snapshot/image.js TAP image (snapshot) > missing image path 1`] = `
+<div class="image-container"><div class="image-inner-area"><div class="image-text-area">(This image file is missing)</div></div></div>
+`
+
+exports[`test/snapshot/image.js TAP image (snapshot) > missing image path w/ missingSourceContent 1`] = `
+<div class="image-container"><div class="image-inner-area"><div class="image-text-area">Cover's missing, whoops</div></div></div>
+`
+
 exports[`test/snapshot/image.js TAP image (snapshot) > source missing 1`] = `
 <div class="image-container placeholder-image"><div class="image-inner-area"><div class="image-text-area">Example of missing source message.</div></div></div>
 `
diff --git a/test/snapshot/image.js b/test/snapshot/image.js
index 8608ab69..2a1e9805 100644
--- a/test/snapshot/image.js
+++ b/test/snapshot/image.js
@@ -14,6 +14,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
         getThumbnailEqualOrSmaller: () => 'medium',
         getThumbnailsAvailableForDimensions: () =>
           [['large', 800], ['medium', 400], ['small', 250]],
+        missingImagePaths: ['album-art/missing/cover.png'],
         ...extraDependencies,
       },
       ...opts,
@@ -114,6 +115,7 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
       getThumbnailsAvailableForDimensions: () =>
         [['voluminous', 1200], ['middling', 900], ['petite', 20]],
       getThumbnailEqualOrSmaller: () => 'voluminous',
+      missingImagePaths: [],
     },
     slots: {
       thumb: 'gargantuan',
@@ -127,4 +129,20 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
       path: ['media.flashArt', '5426', 'gif'],
     },
   });
+
+  quickSnapshot('missing image path', {
+    slots: {
+      thumb: 'medium',
+      path: ['media.albumCover', 'missing', 'png'],
+      link: true,
+    },
+  });
+
+  quickSnapshot('missing image path w/ missingSourceContent', {
+    slots: {
+      thumb: 'medium',
+      path: ['media.albumCover', 'missing', 'png'],
+      missingSourceContent: `Cover's missing, whoops`,
+    },
+  });
 });