« get me outta code hell

content: linkContribution: take standard {who, what} object - 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-06-24 17:55:00 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-24 17:55:00 -0300
commit64b4a5e6355872c49429f1d19c3403277d032b6c (patch)
treef7224646e1e9027e57df895648d54ac132005677 /test
parent0020a0de027d04607c7765c84b891750dc35f41b (diff)
content: linkContribution: take standard {who, what} object
This is what's used for all contributions anyway, so no need to
have every call to linkContribution manually destructure whatever
contribution is being provided.
Diffstat (limited to 'test')
-rw-r--r--test/snapshot/linkContribution.js51
-rw-r--r--test/unit/content/dependencies/linkContribution.js12
2 files changed, 29 insertions, 34 deletions
diff --git a/test/snapshot/linkContribution.js b/test/snapshot/linkContribution.js
index 44033ad3..10b1bd08 100644
--- a/test/snapshot/linkContribution.js
+++ b/test/snapshot/linkContribution.js
@@ -2,37 +2,33 @@ 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]},
+        {args: [
+          {who: {
+            name: 'Clark Powell',
+            directory: 'clark-powell',
+            urls: ['https://soundcloud.com/plazmataz'],
+          }, what: null},
+        ]},
+        {args: [
+          {who: {
+            name: 'Grounder & Scratch',
+            directory: 'the-big-baddies',
+            urls: [],
+          }, what: 'Snooping'},
+        ]},
+        {args: [
+          {who: {
+            name: 'Toby Fox',
+            directory: 'toby-fox',
+            urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
+          }, what: 'Arrangement'},
+        ]},
       ],
       slots,
     });
@@ -55,7 +51,7 @@ testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => {
   evaluate.snapshot('loads of links', {
     name: 'linkContribution',
     args: [
-      {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
+      {who: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
         'https://loremipsum.io',
         'https://loremipsum.io/generator/',
         'https://loremipsum.io/#meaning',
@@ -64,8 +60,7 @@ testContentFunctions(t, 'linkContribution (snapshot)', async (t, evaluate) => {
         'https://loremipsum.io/#when-to-use-lorem-ipsum',
         'https://loremipsum.io/#lorem-ipsum-all-the-things',
         'https://loremipsum.io/#original-source',
-      ]},
-      null,
+      ]}, what: null},
     ],
     slots: {showIcons: true},
   });
diff --git a/test/unit/content/dependencies/linkContribution.js b/test/unit/content/dependencies/linkContribution.js
index 6f3150f7..bed2b6d5 100644
--- a/test/unit/content/dependencies/linkContribution.js
+++ b/test/unit/content/dependencies/linkContribution.js
@@ -64,9 +64,9 @@ t.test('generateContributionLinks (unit)', async t => {
     evaluate({
       name: 'linkContribution',
       multiple: [
-        {args: [who1, what1]},
-        {args: [who2, what2]},
-        {args: [who3, what3]},
+        {args: [{who: who1, what: what1}]},
+        {args: [{who: who2, what: what2}]},
+        {args: [{who: who3, what: what3}]},
       ],
       slots,
     });
@@ -112,9 +112,9 @@ t.test('generateContributionLinks (unit)', async t => {
     evaluate({
       name: 'linkContribution',
       multiple: [
-        {args: [who1, what1]},
-        {args: [who2, what2]},
-        {args: [who3, what3]},
+        {args: [{who: who1, what: what1}]},
+        {args: [{who: who2, what: what2}]},
+        {args: [{who: who3, what: what3}]},
       ],
       slots,
     });