« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/generateTrackCoverArtwork.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/snapshot/generateTrackCoverArtwork.js')
-rw-r--r--test/snapshot/generateTrackCoverArtwork.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/snapshot/generateTrackCoverArtwork.js b/test/snapshot/generateTrackCoverArtwork.js
new file mode 100644
index 0000000..1e651eb
--- /dev/null
+++ b/test/snapshot/generateTrackCoverArtwork.js
@@ -0,0 +1,61 @@
+import t from 'tap';
+import {testContentFunctions} from '#test-lib';
+
+testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => {
+  await evaluate.load({
+    mock: {
+      image: evaluate.stubContentFunction('image'),
+    },
+  });
+
+  const album = {
+    directory: 'bee-forus-seatbelt-safebee',
+    coverArtFileExtension: 'png',
+    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 track1 = {
+    directory: 'beesmp3',
+    hasUniqueCoverArt: true,
+    coverArtFileExtension: 'jpg',
+    color: '#f28514',
+    artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}],
+    album,
+  };
+
+  const track2 = {
+    directory: 'fake-bonus-track',
+    hasUniqueCoverArt: false,
+    color: '#abcdef',
+    album,
+  };
+
+  evaluate.snapshot('display: primary - unique art', {
+    name: 'generateTrackCoverArtwork',
+    args: [track1],
+    slots: {mode: 'primary'},
+  });
+
+  evaluate.snapshot('display: thumbnail - unique art', {
+    name: 'generateTrackCoverArtwork',
+    args: [track1],
+    slots: {mode: 'thumbnail'},
+  });
+
+  evaluate.snapshot('display: primary - no unique art', {
+    name: 'generateTrackCoverArtwork',
+    args: [track2],
+    slots: {mode: 'primary'},
+  });
+
+  evaluate.snapshot('display: thumbnail - no unique art', {
+    name: 'generateTrackCoverArtwork',
+    args: [track2],
+    slots: {mode: 'thumbnail'},
+  });
+});