« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs32
-rw-r--r--test/snapshot/generateCoverArtwork.js33
2 files changed, 65 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs b/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs
new file mode 100644
index 00000000..88be76ea
--- /dev/null
+++ b/tap-snapshots/test/snapshot/generateCoverArtwork.js.test.cjs
@@ -0,0 +1,32 @@
+/* IMPORTANT
+ * This snapshot file is auto-generated, but designed for humans.
+ * It should be checked into source control and tracked carefully.
+ * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
+ * Make sure to inspect the output below.  Do not ignore changes!
+ */
+'use strict'
+exports[`test/snapshot/generateCoverArtwork.js TAP generateCoverArtwork (snapshot) > display: primary 1`] = `
+<div id="cover-art-container">
+    <a id="cover-art" class="box image-link" href="media/album-art/bee-forus-seatbelt-safebee/cover.png">
+        <div class="square">
+            <div class="square-content">
+                <div class="reveal">
+                    <div class="image-container"><div class="image-inner-area"><img data-original-size="0" src="media/album-art/bee-forus-seatbelt-safebee/cover.medium.jpg"></div></div>
+                    <span class="reveal-text-container">
+                        <span class="reveal-text">
+                            cw: creepy crawlies
+                            <br>
+                            <span class="reveal-interaction">click to show</span>
+                        </span>
+                    </span>
+                </div>
+            </div>
+        </div>
+    </a>
+    <p>Tags: <a href="tag/damara/">Damara</a>, <a href="tag/cronus/">Cronus</a>, <a href="tag/bees/">Bees</a></p>
+</div>
+`
+
+exports[`test/snapshot/generateCoverArtwork.js TAP generateCoverArtwork (snapshot) > display: thumbnail 1`] = `
+<div class="square"><div class="square-content"><div class="image-container"><div class="image-inner-area"><img src="media/album-art/bee-forus-seatbelt-safebee/cover.small.jpg"></div></div></div></div>
+`
diff --git a/test/snapshot/generateCoverArtwork.js b/test/snapshot/generateCoverArtwork.js
new file mode 100644
index 00000000..7c56f04d
--- /dev/null
+++ b/test/snapshot/generateCoverArtwork.js
@@ -0,0 +1,33 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'generateCoverArtwork (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  const extraDependencies = {
+    getSizeOfImageFile: () => 0,
+  };
+
+  const artTags = [
+    {name: 'Damara', directory: 'damara', isContentWarning: false},
+    {name: 'Cronus', directory: 'cronus', isContentWarning: false},
+    {name: 'Bees', directory: 'bees', isContentWarning: false},
+    {name: 'creepy crawlies', isContentWarning: true},
+  ];
+
+  const path = ['media.albumCover', 'bee-forus-seatbelt-safebee', 'png'];
+
+  evaluate.snapshot('display: primary', {
+    name: 'generateCoverArtwork',
+    args: [artTags],
+    slots: {path, displayMode: 'primary'},
+    extraDependencies,
+  });
+
+  evaluate.snapshot('display: thumbnail', {
+    name: 'generateCoverArtwork',
+    args: [artTags],
+    slots: {path, displayMode: 'thumbnail'},
+    extraDependencies,
+  });
+});