« get me outta code hell

test: generateAlbumSidebarGroupBox (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>2023-06-14 13:18:51 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-14 13:18:51 -0300
commitafe95ef37cf2bbb486515d2f2cc46522f582daaf (patch)
treed6c6f88a4e8504e20f9f94c0378c284e69ce32d9
parent4fd479469d0b6463e5dd51ce62c227482aa813c6 (diff)
test: generateAlbumSidebarGroupBox (snapshot)
-rw-r--r--tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs25
-rw-r--r--test/snapshot/generateAlbumSidebarGroupBox.js55
2 files changed, 80 insertions, 0 deletions
diff --git a/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs
new file mode 100644
index 00000000..3be84969
--- /dev/null
+++ b/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs
@@ -0,0 +1,25 @@
+/* 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/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > basic behavior, mode: album 1`] = `
+<h1><a href="group/vcg/">VCG</a></h1>
+Very cool group.
+<p>Visit on <a href="https://vcg.bandcamp.com/" class="nowrap">Bandcamp</a> or <a href="https://youtube.com/@vcg" class="nowrap">YouTube</a>.</p>
+<p class="group-chronology-link">Next: <a href="album/last/">Last</a></p>
+<p class="group-chronology-link">Previous: <a href="album/first/">First</a></p>
+`
+
+exports[`test/snapshot/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > basic behavior, mode: track 1`] = `
+<h1><a href="group/vcg/">VCG</a></h1>
+<p>Visit on <a href="https://vcg.bandcamp.com/" class="nowrap">Bandcamp</a> or <a href="https://youtube.com/@vcg" class="nowrap">YouTube</a>.</p>
+`
+
+exports[`test/snapshot/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > dateless album in mixed group 1`] = `
+<h1><a href="group/vcg/">VCG</a></h1>
+Very cool group.
+<p>Visit on <a href="https://vcg.bandcamp.com/" class="nowrap">Bandcamp</a> or <a href="https://youtube.com/@vcg" class="nowrap">YouTube</a>.</p>
+`
diff --git a/test/snapshot/generateAlbumSidebarGroupBox.js b/test/snapshot/generateAlbumSidebarGroupBox.js
new file mode 100644
index 00000000..52348230
--- /dev/null
+++ b/test/snapshot/generateAlbumSidebarGroupBox.js
@@ -0,0 +1,55 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, evaluate) => {
+  await evaluate.load({
+    mock: {
+      ...evaluate.mock.transformContent,
+    },
+  });
+
+  let album, group;
+
+  album = {
+    date: new Date('2010-04-13'),
+  };
+
+  group = {
+    name: 'VCG',
+    directory: 'vcg',
+    descriptionShort: 'Very cool group.',
+    urls: ['https://vcg.bandcamp.com/', 'https://youtube.com/@vcg'],
+    albums: [
+      {name: 'First', directory: 'first', date: new Date('2010-04-10')},
+      album,
+      {name: 'Last', directory: 'last', date: new Date('2010-06-12')},
+    ],
+  };
+
+  evaluate.snapshot('basic behavior, mode: album', {
+    name: 'generateAlbumSidebarGroupBox',
+    args: [album, group],
+    slots: {mode: 'album'},
+  });
+
+  evaluate.snapshot('basic behavior, mode: track', {
+    name: 'generateAlbumSidebarGroupBox',
+    args: [album, group],
+    slots: {mode: 'track'},
+  });
+
+  album = {
+    date: null,
+  };
+
+  group.albums = [
+    ...group.albums,
+    album,
+  ];
+
+  evaluate.snapshot('dateless album in mixed group', {
+    name: 'generateAlbumSidebarGroupBox',
+    args: [album, group],
+    slots: {mode: 'album'},
+  });
+});