« get me outta code hell

test: generateAlbumSidebarGroupBox (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-14 13:18:51 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-14 13:18:51 -0300
commitafe95ef37cf2bbb486515d2f2cc46522f582daaf (patch)
treed6c6f88a4e8504e20f9f94c0378c284e69ce32d9 /test/snapshot
parent4fd479469d0b6463e5dd51ce62c227482aa813c6 (diff)
test: generateAlbumSidebarGroupBox (snapshot)
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/generateAlbumSidebarGroupBox.js55
1 files changed, 55 insertions, 0 deletions
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'},
+  });
+});