« get me outta code hell

test: linkExternal (snapshot) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-04-04 13:32:41 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-04-04 13:32:41 -0300
commit21b6f42b31c39bfc3ee20788d7d055d7afdb5c21 (patch)
treef97e616815fb376fdbb87fea306619d2566323f0 /test
parent22032daecb05f55c31fe469ea6070b98c98d7c1d (diff)
test: linkExternal (snapshot)
Diffstat (limited to 'test')
-rw-r--r--test/snapshot/linkExternal.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js
new file mode 100644
index 0000000..9661aea
--- /dev/null
+++ b/test/snapshot/linkExternal.js
@@ -0,0 +1,57 @@
+import t from 'tap';
+import {testContentFunctions} from '../lib/content-function.js';
+
+testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => {
+  await evaluate.load();
+
+  evaluate.snapshot('missing domain (arbitrary local path)', {
+    name: 'linkExternal',
+    args: ['/foo/bar/baz.mp3']
+  });
+
+  evaluate.snapshot('unknown domain (arbitrary world wide web path)', {
+    name: 'linkExternal',
+    args: ['https://snoo.ping.as/usual/i/see/'],
+  });
+
+  evaluate.snapshot('basic domain matches', {
+    name: 'linkExternal',
+    multiple: [
+      {args: ['https://homestuck.bandcamp.com/']},
+      {args: ['https://soundcloud.com/plazmataz']},
+      {args: ['https://aeritus.tumblr.com/']},
+      {args: ['https://twitter.com/awkwarddoesart']},
+      {args: ['https://www.deviantart.com/chesswanderlust-sama']},
+      {args: ['https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)']},
+      {args: ['https://www.poetryfoundation.org/poets/christina-rossetti']},
+      {args: ['https://www.instagram.com/levc_egm/']},
+      {args: ['https://www.patreon.com/CecilyRenns']},
+      {args: ['https://open.spotify.com/artist/63SNNpNOicDzG3LY82G4q3']},
+      {args: ['https://buzinkai.newgrounds.com/']},
+    ],
+  });
+
+  evaluate.snapshot('custom matches - type: 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'}]},
+
+      // Reuse default when no type specified
+      {args: ['https://youtu.be/abc']},
+      {args: ['https://youtu.be/abc?list=kweh']},
+      {args: ['https://youtube.com/watch?v=abc']},
+      {args: ['https://youtube.com/watch?v=abc&list=kweh']},
+    ],
+  });
+
+  evaluate.snapshot('custom domains for common platforms', {
+    name: 'linkExternal',
+    multiple: [
+      // Just one domain of each platform is OK here
+      {args: ['https://music.solatrus.com/']},
+      {args: ['https://types.pl/']},
+    ],
+  });
+});