« get me outta code hell

test: tidy & add descriptions for existing snapshot tests - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-04-04 13:44:07 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-04-04 13:47:47 -0300
commit762be9d8078a2fd19a460b7172129a9575974f1f (patch)
treec74fe2403e824cc4f9243cb464f800cb0ac81fa0
parent21b6f42b31c39bfc3ee20788d7d055d7afdb5c21 (diff)
test: tidy & add descriptions for existing snapshot tests
-rw-r--r--tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs24
-rw-r--r--tap-snapshots/test/snapshot/linkArtist.js.test.cjs4
-rw-r--r--tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs18
-rw-r--r--tap-snapshots/test/snapshot/linkTemplate.js.test.cjs4
-rw-r--r--test/snapshot/generateContributionLinks.js8
-rw-r--r--test/snapshot/linkArtist.js6
-rw-r--r--test/snapshot/linkExternalFlash.js31
-rw-r--r--test/snapshot/linkTemplate.js6
8 files changed, 43 insertions, 58 deletions
diff --git a/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs
index 51e1ac86..0abd2d38 100644
--- a/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs
+++ b/tap-snapshots/test/snapshot/generateContributionLinks.js.test.cjs
@@ -5,13 +5,21 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
-exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 1`] = `
+exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > no accents 1`] = `
+<a href="artist/clark-powell/">Clark Powell</a>, <a href="artist/the-big-baddies/">Grounder & Scratch</a>, and <a href="artist/toby-fox/">Toby Fox</a>
+`
+
+exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > only showContribution 1`] = `
+<a href="artist/clark-powell/">Clark Powell</a>, <a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping), and <a href="artist/toby-fox/">Toby Fox</a> (Arrangement)
+`
+
+exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > only showIcons 1`] = `
 <a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon">
         <svg>
             <title>SoundCloud</title>
             <use href="static/icons.svg#icon-soundcloud"></use>
         </svg>
-    </a></span>), <a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping), and <a href="artist/toby-fox/">Toby Fox</a> (Arrangement) (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon">
+    </a></span>), <a href="artist/the-big-baddies/">Grounder & Scratch</a>, and <a href="artist/toby-fox/">Toby Fox</a> (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon">
         <svg>
             <title>Bandcamp</title>
             <use href="static/icons.svg#icon-bandcamp"></use>
@@ -24,17 +32,13 @@ exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLink
     </a></span>)
 `
 
-exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 2`] = `
-<a href="artist/clark-powell/">Clark Powell</a>, <a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping), and <a href="artist/toby-fox/">Toby Fox</a> (Arrangement)
-`
-
-exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 3`] = `
+exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > showContribution & showIcons 1`] = `
 <a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon">
         <svg>
             <title>SoundCloud</title>
             <use href="static/icons.svg#icon-soundcloud"></use>
         </svg>
-    </a></span>), <a href="artist/the-big-baddies/">Grounder & Scratch</a>, and <a href="artist/toby-fox/">Toby Fox</a> (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon">
+    </a></span>), <a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping), and <a href="artist/toby-fox/">Toby Fox</a> (Arrangement) (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon">
         <svg>
             <title>Bandcamp</title>
             <use href="static/icons.svg#icon-bandcamp"></use>
@@ -46,7 +50,3 @@ exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLink
         </svg>
     </a></span>)
 `
-
-exports[`test/snapshot/generateContributionLinks.js TAP generateContributionLinks (snapshot) > output 4`] = `
-<a href="artist/clark-powell/">Clark Powell</a>, <a href="artist/the-big-baddies/">Grounder & Scratch</a>, and <a href="artist/toby-fox/">Toby Fox</a>
-`
diff --git a/tap-snapshots/test/snapshot/linkArtist.js.test.cjs b/tap-snapshots/test/snapshot/linkArtist.js.test.cjs
index 647742e0..77516f3f 100644
--- a/tap-snapshots/test/snapshot/linkArtist.js.test.cjs
+++ b/tap-snapshots/test/snapshot/linkArtist.js.test.cjs
@@ -5,10 +5,10 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
-exports[`test/snapshot/linkArtist.js TAP linkArtist > output 1`] = `
+exports[`test/snapshot/linkArtist.js TAP linkArtist (snapshot) > basic behavior 1`] = `
 <a href="artist/toby-fox/">Toby Fox</a>
 `
 
-exports[`test/snapshot/linkArtist.js TAP linkArtist > output 2`] = `
+exports[`test/snapshot/linkArtist.js TAP linkArtist (snapshot) > prefer short name 1`] = `
 <a href="artist/55gore/">55gore</a>
 `
diff --git a/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs b/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs
index e4d001a9..d7f6c1c3 100644
--- a/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs
+++ b/tap-snapshots/test/snapshot/linkExternalFlash.js.test.cjs
@@ -5,22 +5,14 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
-exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 1`] = `
+exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > basic behavior 1`] = `
 <span class="nowrap"><a href="https://homestuck.com/story/4109/" class="nowrap">homestuck.com</a> (page 4109)</span>
-`
-
-exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 2`] = `
-<span class="nowrap"><a href="https://homestuck.com/story/pony/" class="nowrap">homestuck.com</a> (secret page)</span>
-`
-
-exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 3`] = `
 <span class="nowrap"><a href="https://youtu.be/FDt-SLyEcjI" class="nowrap">YouTube</a> (on any device)</span>
-`
-
-exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 4`] = `
 <span class="nowrap"><a href="https://www.bgreco.net/hsflash/006009.html" class="nowrap">www.bgreco.net</a> (HQ Audio)</span>
+<span class="nowrap"><a href="https://www.newgrounds.com/portal/view/582345" class="nowrap">Newgrounds</a></span>
 `
 
-exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > output 5`] = `
-<span class="nowrap"><a href="https://www.newgrounds.com/portal/view/582345" class="nowrap">Newgrounds</a></span>
+exports[`test/snapshot/linkExternalFlash.js TAP linkExternalFlash (snapshot) > secret page 1`] = `
+<span class="nowrap"><a href="https://homestuck.com/story/pony/" class="nowrap">homestuck.com</a> (secret page)</span>
+<span class="nowrap"><a href="https://youtu.be/USB1pj6hAjU" class="nowrap">YouTube</a> (on any device)</span>
 `
diff --git a/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs b/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs
index 4ca3e00f..9063eace 100644
--- a/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs
+++ b/tap-snapshots/test/snapshot/linkTemplate.js.test.cjs
@@ -5,10 +5,10 @@
  * Make sure to inspect the output below.  Do not ignore changes!
  */
 'use strict'
-exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 1`] = `
+exports[`test/snapshot/linkTemplate.js TAP linkTemplate (snapshot) > fill many slots 1`] = `
 <a class="dog" id="cat1" href="https://hsmusic.wiki/media/cool%20file.pdf#fooey" style="--primary-color: #123456ff; --dim-color: #12345677">My Cool Link</a>
 `
 
-exports[`test/snapshot/linkTemplate.js TAP linkTemplate > output 2`] = `
+exports[`test/snapshot/linkTemplate.js TAP linkTemplate (snapshot) > fill path slot 1`] = `
 <a href="/c*lzone/myCoolPath/ham/pineapple/tomato/index.html"></a>
 `
diff --git a/test/snapshot/generateContributionLinks.js b/test/snapshot/generateContributionLinks.js
index 10d225cd..deecf9ef 100644
--- a/test/snapshot/generateContributionLinks.js
+++ b/test/snapshot/generateContributionLinks.js
@@ -28,22 +28,22 @@ testContentFunctions(t, 'generateContributionLinks (snapshot)', async (t, evalua
 
   await evaluate.load();
 
-  evaluate.snapshot({
+  evaluate.snapshot('showContribution & showIcons', {
     name: 'generateContributionLinks',
     args: [contributions, {showContribution: true, showIcons: true}],
   });
 
-  evaluate.snapshot({
+  evaluate.snapshot('only showContribution', {
     name: 'generateContributionLinks',
     args: [contributions, {showContribution: true, showIcons: false}],
   });
 
-  evaluate.snapshot({
+  evaluate.snapshot('only showIcons', {
     name: 'generateContributionLinks',
     args: [contributions, {showContribution: false, showIcons: true}],
   });
 
-  evaluate.snapshot({
+  evaluate.snapshot('no accents', {
     name: 'generateContributionLinks',
     args: [contributions, {showContribution: false, showIcons: false}],
   });
diff --git a/test/snapshot/linkArtist.js b/test/snapshot/linkArtist.js
index 633e2ae6..e479ece0 100644
--- a/test/snapshot/linkArtist.js
+++ b/test/snapshot/linkArtist.js
@@ -1,10 +1,10 @@
 import t from 'tap';
 import {testContentFunctions} from '../lib/content-function.js';
 
-testContentFunctions(t, 'linkArtist', async (t, evaluate) => {
+testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => {
   await evaluate.load();
 
-  evaluate.snapshot({
+  evaluate.snapshot('basic behavior', {
     name: 'linkArtist',
     args: [
       {
@@ -14,7 +14,7 @@ testContentFunctions(t, 'linkArtist', async (t, evaluate) => {
     ],
   });
 
-  evaluate.snapshot({
+  evaluate.snapshot('prefer short name', {
     name: 'linkArtist',
     args: [
       {
diff --git a/test/snapshot/linkExternalFlash.js b/test/snapshot/linkExternalFlash.js
index 3f63760f..7bb86c6a 100644
--- a/test/snapshot/linkExternalFlash.js
+++ b/test/snapshot/linkExternalFlash.js
@@ -4,28 +4,21 @@ import {testContentFunctions} from '../lib/content-function.js';
 testContentFunctions(t, 'linkExternalFlash (snapshot)', async (t, evaluate) => {
   await evaluate.load();
 
-  evaluate.snapshot({
+  evaluate.snapshot('basic behavior', {
     name: 'linkExternalFlash',
-    args: ['https://homestuck.com/story/4109/', {page: '4109'}],
+    multiple: [
+      {args: ['https://homestuck.com/story/4109/', {page: '4109'}]},
+      {args: ['https://youtu.be/FDt-SLyEcjI', {page: '4109'}]},
+      {args: ['https://www.bgreco.net/hsflash/006009.html', {page: '4109'}]},
+      {args: ['https://www.newgrounds.com/portal/view/582345', {page: '4109'}]},
+    ],
   });
 
-  evaluate.snapshot({
+  evaluate.snapshot('secret page', {
     name: 'linkExternalFlash',
-    args: ['https://homestuck.com/story/pony/', {page: 'pony'}],
+    multiple: [
+      {args: ['https://homestuck.com/story/pony/', {page: 'pony'}]},
+      {args: ['https://youtu.be/USB1pj6hAjU', {page: 'pony'}]},
+    ],
   });
-
-  evaluate.snapshot({
-    name: 'linkExternalFlash',
-    args: ['https://youtu.be/FDt-SLyEcjI', {page: '4109'}],
-  });
-
-  evaluate.snapshot({
-    name: 'linkExternalFlash',
-    args: ['https://www.bgreco.net/hsflash/006009.html', {page: '4109'}],
-  });
-
-  evaluate.snapshot({
-    name: 'linkExternalFlash',
-    args: ['https://www.newgrounds.com/portal/view/582345', {page: '4109'}],
-  })
 });
diff --git a/test/snapshot/linkTemplate.js b/test/snapshot/linkTemplate.js
index 10321897..07c3b501 100644
--- a/test/snapshot/linkTemplate.js
+++ b/test/snapshot/linkTemplate.js
@@ -1,10 +1,10 @@
 import t from 'tap';
 import {testContentFunctions} from '../lib/content-function.js';
 
-testContentFunctions(t, 'linkTemplate', async (t, evaluate) => {
+testContentFunctions(t, 'linkTemplate (snapshot)', async (t, evaluate) => {
   await evaluate.load();
 
-  evaluate.snapshot({
+  evaluate.snapshot('fill many slots', {
     name: 'linkTemplate',
     extraDependencies: {
       getColors: c => ({primary: c + 'ff', dim: c + '77'}),
@@ -17,7 +17,7 @@ testContentFunctions(t, 'linkTemplate', async (t, evaluate) => {
       .slot('attributes', {class: 'dog', id: 'cat1'})
       .slot('content', 'My Cool Link'));
 
-  evaluate.snapshot({
+  evaluate.snapshot('fill path slot', {
     name: 'linkTemplate',
     extraDependencies: {
       to: (...path) => '/c*lzone/' + path.join('/') + '/',