From 243af63c1ca36343f780b6e95b05493ff03ca68b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 24 Sep 2023 10:01:14 -0300 Subject: test: image: supply & test missingImagePaths --- tap-snapshots/test/snapshot/image.js.test.cjs | 8 ++++++++ test/snapshot/image.js | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/tap-snapshots/test/snapshot/image.js.test.cjs b/tap-snapshots/test/snapshot/image.js.test.cjs index d87ab71..3cd1a31 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`] =
` +exports[`test/snapshot/image.js TAP image (snapshot) > missing image path 1`] = ` +
(This image file is missing)
+` + +exports[`test/snapshot/image.js TAP image (snapshot) > missing image path w/ missingSourceContent 1`] = ` +
Cover's missing, whoops
+` + exports[`test/snapshot/image.js TAP image (snapshot) > source missing 1`] = `
Example of missing source message.
` diff --git a/test/snapshot/image.js b/test/snapshot/image.js index 8608ab6..2a1e980 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`, + }, + }); }); -- cgit 1.3.0-6-gf8a5