« get me outta code hell

test: generateContributionLinks -> linkContribution - 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 12:54:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-13 12:54:20 -0300
commitba41071d9b6647b2e12a78de774a55aef5b87876 (patch)
tree434759eb6bb9d45a96995bbefbaef003a3d79990 /test/snapshot
parent2ce5ddd844603b1c3d8f220a12603677104b7545 (diff)
test: generateContributionLinks -> linkContribution
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/generateContributionLinks.js55
-rw-r--r--test/snapshot/linkContribution.js54
2 files changed, 54 insertions, 55 deletions
diff --git a/test/snapshot/generateContributionLinks.js b/test/snapshot/generateContributionLinks.js
deleted file mode 100644
index 3283d3b2..00000000
--- a/test/snapshot/generateContributionLinks.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// todo: this dependency was replaced with linkContribution, restructure test
-// remove generateContributionLinks.js.test.cjs snapshot file too!
-
-import t from 'tap';
-import {testContentFunctions} from '../lib/content-function.js';
-
-t.skip('generateContributionLinks (snapshot)');
-
-void (() => 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('showContribution & showIcons', {
-    name: 'generateContributionLinks',
-    args: [contributions, {showContribution: true, showIcons: true}],
-  });
-
-  evaluate.snapshot('only showContribution', {
-    name: 'generateContributionLinks',
-    args: [contributions, {showContribution: true, showIcons: false}],
-  });
-
-  evaluate.snapshot('only showIcons', {
-    name: 'generateContributionLinks',
-    args: [contributions, {showContribution: false, showIcons: true}],
-  });
-
-  evaluate.snapshot('no accents', {
-    name: 'generateContributionLinks',
-    args: [contributions, {showContribution: false, showIcons: false}],
-  });
-}));
diff --git a/test/snapshot/linkContribution.js b/test/snapshot/linkContribution.js
new file mode 100644
index 00000000..758fa264
--- /dev/null
+++ b/test/snapshot/linkContribution.js
@@ -0,0 +1,54 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => {
+  const who1 = {
+    name: 'Clark Powell',
+    directory: 'clark-powell',
+    urls: ['https://soundcloud.com/plazmataz'],
+  };
+
+  const who2 = {
+    name: 'Grounder & Scratch',
+    directory: 'the-big-baddies',
+    urls: [],
+  };
+
+  const who3 = {
+    name: 'Toby Fox',
+    directory: 'toby-fox',
+    urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
+  };
+
+  const what1 = null;
+  const what2 = 'Snooping';
+  const what3 = 'Arrangement';
+
+  await evaluate.load();
+
+  const quickSnapshot = (message, slots) =>
+    evaluate.snapshot(message, {
+      name: 'linkContribution',
+      multiple: [
+        {args: [who1, what1]},
+        {args: [who2, what2]},
+        {args: [who3, what3]},
+      ],
+      slots,
+    });
+
+  quickSnapshot('showContribution & showIcons', {
+    showContribution: true,
+    showIcons: true,
+  });
+
+  quickSnapshot('only showContribution', {
+    showContribution: true,
+  });
+
+  quickSnapshot('only showIcons', {
+    showIcons: true,
+  });
+
+  quickSnapshot('no accents', {});
+});