« get me outta code hell

test: generateTrackReleaseInfo (snapshot) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-13 13:14:35 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-13 13:14:35 -0300
commitafdc1e4bee3eba30a83ec3f71617573331d98169 (patch)
treeec0aba7f6e13a826b8a138f46914dd38127e09ca /test/snapshot
parent444cb054d5d18f320680e3badee453af1cc17d88 (diff)
test: generateTrackReleaseInfo (snapshot)
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/generateTrackReleaseInfo.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/snapshot/generateTrackReleaseInfo.js b/test/snapshot/generateTrackReleaseInfo.js
new file mode 100644
index 00000000..c9c40684
--- /dev/null
+++ b/test/snapshot/generateTrackReleaseInfo.js
@@ -0,0 +1,51 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox'}, what: null}];
+  const coverArtistContribs = [{who: {name: 'Alpaca', directory: 'alpaca'}, what: '🔥'}];
+
+  evaluate.snapshot('basic behavior', {
+    name: 'generateTrackReleaseInfo',
+    args: [{
+      artistContribs,
+      name: 'An Apple Disaster!!',
+      date: new Date('2011-11-30'),
+      duration: 58,
+      urls: ['https://soundcloud.com/foo', 'https://youtube.com/watch?v=bar'],
+    }],
+  });
+
+  const sparse = {
+    artistContribs,
+    name: 'Suspicious Track',
+    date: null,
+    duration: null,
+    urls: [],
+  };
+
+  evaluate.snapshot('reduced details', {
+    name: 'generateTrackReleaseInfo',
+    args: [sparse],
+  });
+
+  evaluate.snapshot('cover artist contribs, non-unique', {
+    name: 'generateTrackReleaseInfo',
+    args: [{
+      ...sparse,
+      coverArtistContribs,
+      hasUniqueCoverArt: false,
+    }],
+  });
+
+  evaluate.snapshot('cover artist contribs, unique', {
+    name: 'generateTrackReleaseInfo',
+    args: [{
+      ...sparse,
+      coverArtistContribs,
+      hasUniqueCoverArt: true,
+    }],
+  });
+});