« 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/snapshot/linkContribution.js
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/snapshot/linkContribution.js
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/snapshot/linkContribution.js')
-rw-r--r--test/snapshot/linkContribution.js51
1 files changed, 23 insertions, 28 deletions
diff --git a/test/snapshot/linkContribution.js b/test/snapshot/linkContribution.js
index 44033ad..10b1bd0 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},
   });