« get me outta code hell

test: generateContributionLinks (snapshot) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:48:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:48:14 -0300
commit0e7e812ac63813c04e4e4f0cb00f734a6f44dc46 (patch)
tree2cf4349207814d8f992346de04f9452754b38012 /test
parent543d087fc465ea56ec0b156d488119c3a64c55aa (diff)
test: generateContributionLinks (snapshot)
Diffstat (limited to 'test')
-rw-r--r--test/snapshot/generateContributionLinks.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/snapshot/generateContributionLinks.js b/test/snapshot/generateContributionLinks.js
new file mode 100644
index 0000000..10d225c
--- /dev/null
+++ b/test/snapshot/generateContributionLinks.js
@@ -0,0 +1,50 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'generateContributionLinks (snapshot)', async (t, evaluate) => {
+  const artist1 = {
+    name: 'Clark Powell',
+    directory: 'clark-powell',
+    urls: ['https://soundcloud.com/plazmataz'],
+  };
+
+  const artist2 = {
+    name: 'Grounder & Scratch',
+    directory: 'the-big-baddies',
+    urls: [],
+  };
+
+  const artist3 = {
+    name: 'Toby Fox',
+    directory: 'toby-fox',
+    urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
+  };
+
+  const contributions = [
+    {who: artist1, what: null},
+    {who: artist2, what: 'Snooping'},
+    {who: artist3, what: 'Arrangement'},
+  ];
+
+  await evaluate.load();
+
+  evaluate.snapshot({
+    name: 'generateContributionLinks',
+    args: [contributions, {showContribution: true, showIcons: true}],
+  });
+
+  evaluate.snapshot({
+    name: 'generateContributionLinks',
+    args: [contributions, {showContribution: true, showIcons: false}],
+  });
+
+  evaluate.snapshot({
+    name: 'generateContributionLinks',
+    args: [contributions, {showContribution: false, showIcons: true}],
+  });
+
+  evaluate.snapshot({
+    name: 'generateContributionLinks',
+    args: [contributions, {showContribution: false, showIcons: false}],
+  });
+});