« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tap-snapshots/test/snapshot/linkExternal.js.test.cjs2
-rw-r--r--test/snapshot/generateAdditionalFilesList.js11
-rw-r--r--test/snapshot/image.js83
-rw-r--r--test/snapshot/linkArtist.js6
-rw-r--r--test/snapshot/linkExternal.js13
-rw-r--r--test/snapshot/linkTemplate.js18
6 files changed, 73 insertions, 60 deletions
diff --git a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs
index 5a3ef738..156b7f90 100644
--- a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs
+++ b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs
@@ -24,7 +24,7 @@ exports[`test/snapshot/linkExternal.js TAP linkExternal (snapshot) > custom doma
 <a href="https://types.pl/" class="nowrap">Mastodon (types.pl)</a>
 `
 
-exports[`test/snapshot/linkExternal.js TAP linkExternal (snapshot) > custom matches - type: album 1`] = `
+exports[`test/snapshot/linkExternal.js TAP linkExternal (snapshot) > custom matches - album 1`] = `
 <a href="https://youtu.be/abc" class="nowrap">YouTube (full album)</a>
 <a href="https://youtube.com/watch?v=abc" class="nowrap">YouTube (full album)</a>
 <a href="https://youtube.com/Playlist?list=kweh" class="nowrap">YouTube (playlist)</a>
diff --git a/test/snapshot/generateAdditionalFilesList.js b/test/snapshot/generateAdditionalFilesList.js
index 0c27ad19..60b46ae8 100644
--- a/test/snapshot/generateAdditionalFilesList.js
+++ b/test/snapshot/generateAdditionalFilesList.js
@@ -41,16 +41,16 @@ testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, eval
         },
       ],
     ],
-    postprocess: template => template
-      .slot('fileLinks', {
+    slots: {
+      fileLinks: {
         'sburbwp_1280x1024.jpg': 'link to 1280x1024',
         'sburbwp_1440x900.jpg': 'link to 1440x900',
         'sburbwp_1920x1080.jpg': null,
         'Homestuck_Vol4_alt1.jpg': 'link to alt1',
         'Homestuck_Vol4_alt2.jpg': null,
         'Homestuck_Vol4_alt3.jpg': 'link to alt3',
-      })
-      .slot('fileSizes', {
+      },
+      fileSizes: {
         'sburbwp_1280x1024.jpg': 2500,
         'sburbwp_1440x900.jpg': null,
         'sburbwp_1920x1080.jpg': null,
@@ -58,6 +58,7 @@ testContentFunctions(t, 'generateAdditionalFilesList (snapshot)', async (t, eval
         'Homestuck_Vol4_alt1.jpg': 1234567,
         'Homestuck_Vol4_alt2.jpg': 1234567,
         'Homestuck_Vol4_alt3.jpg': 1234567,
-      }),
+      }
+    },
   });
 });
diff --git a/test/snapshot/image.js b/test/snapshot/image.js
index eeffb849..62e1cd9a 100644
--- a/test/snapshot/image.js
+++ b/test/snapshot/image.js
@@ -14,68 +14,77 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
     });
 
   quickSnapshot('source via path', {
-    postprocess: template => template
-      .slot('path', ['media.albumCover', 'beyond-canon', 'png']),
+    slots: {
+      path: ['media.albumCover', 'beyond-canon', 'png'],
+    },
   });
 
   quickSnapshot('source via src', {
-    postprocess: template => template
-      .slot('src', 'https://example.com/bananas.gif'),
+    slots: {
+      src: 'https://example.com/bananas.gif',
+    },
   });
 
   quickSnapshot('source missing', {
-    postprocess: template => template
-      .slot('missingSourceContent', 'Example of missing source message.'),
+    slots: {
+      missingSourceContent: 'Example of missing source message.',
+    },
   });
 
   quickSnapshot('id without link', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('id', 'banana'),
+    slots: {
+      src: 'foobar',
+      id: 'banana',
+    },
   });
 
   quickSnapshot('id with link', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('link', true)
-      .slot('id', 'banana'),
+    slots: {
+      src: 'foobar',
+      link: true,
+      id: 'banana',
+    },
   });
 
   quickSnapshot('id with square', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('square', true)
-      .slot('id', 'banana'),
-  })
+    slots: {
+      src: 'foobar',
+      square: true,
+      id: 'banana',
+    },
+  });
 
   quickSnapshot('width & height', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('width', 600)
-      .slot('height', 400),
+    slots: {
+      src: 'foobar',
+      width: 600,
+      height: 400,
+    },
   });
 
   quickSnapshot('square', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('square', true),
+    slots: {
+      src: 'foobar',
+      square: true,
+    },
   });
 
   quickSnapshot('lazy with square', {
-    postprocess: template => template
-      .slot('src', 'foobar')
-      .slot('lazy', true)
-      .slot('square', true),
+    slots: {
+      src: 'foobar',
+      lazy: true,
+      square: true,
+    },
   });
 
   quickSnapshot('link with file size', {
     extraDependencies: {
       getSizeOfImageFile: () => 10 ** 6,
     },
-
-    postprocess: template => template
-      .slot('path', ['media.albumCover', 'pingas', 'png'])
-      .slot('link', true),
+    slots: {
+      path: ['media.albumCover', 'pingas', 'png'],
+      link: true,
+    },
   });
 
   quickSnapshot('content warnings via tags', {
@@ -85,8 +94,8 @@ testContentFunctions(t, 'image (snapshot)', async (t, evaluate) => {
         {name: 'too cool for school', isContentWarning: true},
       ],
     ],
-
-    postprocess: template => template
-      .slot('path', ['media.albumCover', 'beyond-canon', 'png']),
-  })
+    slots: {
+      path: ['media.albumCover', 'beyond-canon', 'png'],
+    },
+  });
 });
diff --git a/test/snapshot/linkArtist.js b/test/snapshot/linkArtist.js
index 0451f1c5..684affc3 100644
--- a/test/snapshot/linkArtist.js
+++ b/test/snapshot/linkArtist.js
@@ -23,8 +23,8 @@ testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => {
         directory: '55gore',
       },
     ],
-
-    postprocess: v => v
-      .slot('preferShortName', true),
+    slots: {
+      preferShortName: true,
+    },
   });
 });
diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js
index a65044df..391d5a10 100644
--- a/test/snapshot/linkExternal.js
+++ b/test/snapshot/linkExternal.js
@@ -31,15 +31,16 @@ testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => {
     ],
   });
 
-  evaluate.snapshot('custom matches - type: album', {
+  evaluate.snapshot('custom matches - album', {
     name: 'linkExternal',
     multiple: [
-      {args: ['https://youtu.be/abc', {type: 'album'}]},
-      {args: ['https://youtube.com/watch?v=abc', {type: 'album'}]},
-      {args: ['https://youtube.com/Playlist?list=kweh', {type: 'album'}]},
+      {args: ['https://youtu.be/abc']},
+      {args: ['https://youtube.com/watch?v=abc']},
+      {args: ['https://youtube.com/Playlist?list=kweh']},
     ],
-    postprocess:
-      link => link.slot('mode', 'album'),
+    slots: {
+      mode: 'album',
+    },
   });
 
   evaluate.snapshot('custom domains for common platforms', {
diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js
index e9a1ccd6..bef0935c 100644
--- a/test/snapshot/linkTemplate.js
+++ b/test/snapshot/linkTemplate.js
@@ -11,12 +11,13 @@ testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => {
       getColors: c => ({primary: c + 'ff', dim: c + '77'}),
     },
 
-    postprocess: v => v
-      .slot('color', '#123456')
-      .slot('href', 'https://hsmusic.wiki/media/cool file.pdf')
-      .slot('hash', 'fooey')
-      .slot('attributes', {class: 'dog', id: 'cat1'})
-      .slot('content', 'My Cool Link'),
+    slots: {
+      'color': '#123456',
+      'href': 'https://hsmusic.wiki/media/cool file.pdf',
+      'hash': 'fooey',
+      'attributes': {class: 'dog', id: 'cat1'},
+      'content': 'My Cool Link',
+    },
   });
 
   evaluate.snapshot('fill path slot & provide appendIndexHTML', {
@@ -27,7 +28,8 @@ testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => {
       appendIndexHTML: true,
     },
 
-    postprocess: v => v
-      .slot('path', ['myCoolPath', 'ham', 'pineapple', 'tomato']),
+    slots: {
+      path: ['myCoolPath', 'ham', 'pineapple', 'tomato'],
+    },
   });
 });