« get me outta code hell

test: update generateCoverArtwork (snapshot) - 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>2024-11-17 15:59:44 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-17 16:35:55 -0400
commit8069865a16a0dc4c2e1bbab1e0c1c11e45658d7b (patch)
tree2b10d75152ca57197accb578b7b46a2b3b3514a3
parentc656395edea65e6eead8e3cbe1a9ecb067ad5ef6 (diff)
test: update generateCoverArtwork (snapshot)
-rw-r--r--tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs39
-rw-r--r--test/snapshot/generateCoverArtwork.js26
2 files changed, 52 insertions, 13 deletions
diff --git a/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs b/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs
index f16923d0..e080afaa 100644
--- a/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs
+++ b/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs
@@ -5,7 +5,40 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
-exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > display: primary 1`] = `
+exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > mode: commentary 1`] = `
+[mocked: image
+ args: [
+   [
+     { name: 'Damara', directory: 'damara', isContentWarning: false },
+     { name: 'Cronus', directory: 'cronus', isContentWarning: false },
+     { name: 'Bees', directory: 'bees', isContentWarning: false },
+     { name: 'creepy crawlies', isContentWarning: true }
+   ]
+ ]
+ slots: { path: [ 'media.albumCover', 'bee-forus-seatbelt-safebee', 'png' ], thumb: 'medium', reveal: true, link: true, lazy: true, square: true, attributes: { class: 'commentary-art' } }]
+`
+
+exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > mode: primary-artists 1`] = `
+[mocked: image
+ args: [
+   [
+     { name: 'Damara', directory: 'damara', isContentWarning: false },
+     { name: 'Cronus', directory: 'cronus', isContentWarning: false },
+     { name: 'Bees', directory: 'bees', isContentWarning: false },
+     { name: 'creepy crawlies', isContentWarning: true }
+   ]
+ ]
+ slots: { path: [ 'media.albumCover', 'bee-forus-seatbelt-safebee', 'png' ], thumb: 'medium', reveal: true, link: true, square: true }]
+<p class="image-details illustrator-details">
+    Artwork by [mocked: linkArtistGallery
+     args: [ { name: 'Circlejourney', directory: 'circlejourney' } ]
+     slots: {}] and [mocked: linkArtistGallery
+     args: [ { name: 'magnoliajades', directory: 'magnoliajades' } ]
+     slots: {}]
+</p>
+`
+
+exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > mode: primary-tags 1`] = `
 [mocked: image
  args: [
    [
@@ -16,14 +49,14 @@ exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (sna
    ]
  ]
  slots: { path: [ 'media.albumCover', 'bee-forus-seatbelt-safebee', 'png' ], thumb: 'medium', reveal: true, link: true, square: true }]
-<ul class="image-details">
+<ul class="image-details art-tag-details">
     <li><a href="tag/damara/">Damara</a></li>
     <li><a href="tag/cronus/">Cronus</a></li>
     <li><a href="tag/bees/">Bees</a></li>
 </ul>
 `
 
-exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > display: thumbnail 1`] = `
+exports[`test/snapshot/generateCoverArtwork.js > TAP > generateCoverArtwork (snapshot) > mode: thumbnail 1`] = `
 [mocked: image
  args: [
    [
diff --git a/test/snapshot/generateCoverArtwork.js b/test/snapshot/generateCoverArtwork.js
index e35dd8d0..c2a89557 100644
--- a/test/snapshot/generateCoverArtwork.js
+++ b/test/snapshot/generateCoverArtwork.js
@@ -5,6 +5,7 @@ testContentFunctions(t, 'generateCoverArtwork (snapshot)', async (t, evaluate) =
   await evaluate.load({
     mock: {
       image: evaluate.stubContentFunction('image', {mock: true}),
+      linkArtistGallery: evaluate.stubContentFunction('linkArtistGallery', {mock: true}),
     },
   });
 
@@ -15,17 +16,22 @@ testContentFunctions(t, 'generateCoverArtwork (snapshot)', async (t, evaluate) =
     {name: 'creepy crawlies', isContentWarning: true},
   ];
 
+  const coverArtistContribs = [
+    {artist: {name: 'Circlejourney', directory: 'circlejourney'}},
+    {artist: {name: 'magnoliajades', directory: 'magnoliajades'}},
+  ];
+
   const path = ['media.albumCover', 'bee-forus-seatbelt-safebee', 'png'];
 
-  evaluate.snapshot('display: primary', {
-    name: 'generateCoverArtwork',
-    args: [artTags],
-    slots: {path, mode: 'primary'},
-  });
+  const quickSnapshot = (mode) =>
+    evaluate.snapshot(`mode: ${mode}`, {
+      name: 'generateCoverArtwork',
+      args: [artTags, coverArtistContribs],
+      slots: {path, mode},
+    });
 
-  evaluate.snapshot('display: thumbnail', {
-    name: 'generateCoverArtwork',
-    args: [artTags],
-    slots: {path, mode: 'thumbnail'},
-  });
+  quickSnapshot('primary-tags');
+  quickSnapshot('primary-artists');
+  quickSnapshot('thumbnail');
+  quickSnapshot('commentary');
 });