From ebdc62e0bb57b2e9e0f81f2a8804940c76f007c8 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 30 Mar 2024 10:28:17 -0300 Subject: test: linkExternal: match sort, write some testing guidelines --- .../test/snapshot/linkExternal.js.test.cjs | 56 ++++++++++---------- test/snapshot/linkExternal.js | 61 ++++++++++++++++------ 2 files changed, 74 insertions(+), 43 deletions(-) diff --git a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs index 824bec7..e36ff75 100644 --- a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs @@ -72,47 +72,47 @@ exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > context ` exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > context: generic, style: handle 1`] = ` +music.solatrus.com homestuck -plazmataz -aeritus -awkwarddoesart DeviantArt -Wikipedia -Poetry Foundation -Instagram -CecilyRenns -Spotify -buzinkai -music.solatrus.com -types.pl -Fandom -Fandom -Fandom MSPA Wiki MSPA Wiki MSPA Wiki (Draconian Dignitary) +Fandom +Fandom +Fandom +Instagram +types.pl +buzinkai +CecilyRenns +Poetry Foundation +plazmataz +Spotify +aeritus +awkwarddoesart +Wikipedia ` exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > context: generic, style: platform 1`] = ` +Bandcamp (music.solatrus.com) Bandcamp -SoundCloud -Tumblr -Twitter DeviantArt -Wikipedia -Poetry Foundation -Instagram -Patreon -Spotify -Newgrounds -Bandcamp (music.solatrus.com) -Mastodon (types.pl) -Fandom -Fandom -Fandom MSPA Wiki MSPA Wiki MSPA Wiki (Draconian Dignitary) +Fandom +Fandom +Fandom +Instagram +Mastodon (types.pl) +Newgrounds +Patreon +Poetry Foundation +SoundCloud +Spotify +Tumblr +Twitter +Wikipedia ` exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > unknown domain (arbitrary world wide web path) 1`] = ` diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js index 6c43ea3..35af656 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', [ -- cgit 1.3.0-6-gf8a5