« get me outta code hell

test: linkExternal: match sort, write some testing guidelines - 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>2024-03-30 10:28:17 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-03-30 10:29:08 -0300
commitebdc62e0bb57b2e9e0f81f2a8804940c76f007c8 (patch)
tree2468ac5fc4fcf23430649a98ef4a6d911d9ac085 /test/snapshot
parentb7f8d726125f6204e67393a02d5b42daaf814ee6 (diff)
test: linkExternal: match sort, write some testing guidelines
Diffstat (limited to 'test/snapshot')
-rw-r--r--test/snapshot/linkExternal.js61
1 files changed, 46 insertions, 15 deletions
diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js
index 6c43ea35..35af656b 100644
--- a/test/snapshot/linkExternal.js
+++ b/test/snapshot/linkExternal.js
@@ -26,29 +26,60 @@ testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => {
     }
   };
 
+  // Try to comprehensively test every regular expression
+  // (in `match` and extractions like `handle` or `details`).
+
+  // For normal custom-domain matches (e.g. Mastodon),
+  // it's OK to just test one custom domain in the list.
+
+  // Generally match the sorting order in externalLinkSpec,
+  // so corresponding and missing test cases are easy to locate.
+
   quickSnapshotAllStyles('generic', [
+    // platform: bandcamp
+    'https://music.solatrus.com/',
     'https://homestuck.bandcamp.com/',
-    'https://soundcloud.com/plazmataz',
-    'https://aeritus.tumblr.com/',
-    'https://twitter.com/awkwarddoesart',
+
+    // platform: deviantart
     'https://www.deviantart.com/chesswanderlust-sama',
-    'https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)',
-    'https://www.poetryfoundation.org/poets/christina-rossetti',
+
+    // platform: fandom
+    'https://mspaintadventures.fandom.com/',
+    'https://mspaintadventures.fandom.com/wiki/',
+    'https://mspaintadventures.fandom.com/wiki/Draconian_Dignitary',
+    'https://community.fandom.com/',
+    'https://community.fandom.com/wiki/',
+    'https://community.fandom.com/wiki/Community_Central',
+
+    // platform: instagram
     'https://www.instagram.com/levc_egm/',
+
+    // platform: mastodon
+    'https://types.pl/',
+
+    // platform: newgrounds
+    'https://buzinkai.newgrounds.com/',
+
+    // platform: patreon
     'https://www.patreon.com/CecilyRenns',
+
+    // platform: poetryFoundation
+    'https://www.poetryfoundation.org/poets/christina-rossetti',
+
+    // platform: soundcloud
+    'https://soundcloud.com/plazmataz',
+
+    // platform: spotify
     'https://open.spotify.com/artist/63SNNpNOicDzG3LY82G4q3',
-    'https://buzinkai.newgrounds.com/',
 
-    // Just one custom domain of each platform is OK here
-    'https://music.solatrus.com/',
-    'https://types.pl/',
+    // platform: tumblr
+    'https://aeritus.tumblr.com/',
 
-    'https://community.fandom.com/',
-    'https://community.fandom.com/wiki/',
-    'https://community.fandom.com/wiki/Community_Central',
-    'https://mspaintadventures.fandom.com/',
-    'https://mspaintadventures.fandom.com/wiki/',
-    'https://mspaintadventures.fandom.com/wiki/Draconian_Dignitary',
+    // platform: twitter
+    'https://twitter.com/awkwarddoesart',
+
+    // platform: wikipedia
+    'https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)',
   ]);
 
   quickSnapshotAllStyles('album', [