« get me outta code hell

linkExternal.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/linkExternal.js
blob: 3e8aee0d4796d6262c6f91489958d19432974cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import t from 'tap';
import {testContentFunctions} from '#test-lib';

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 - album', {
    name: 'linkExternal',
    multiple: [
      {args: ['https://youtu.be/abc']},
      {args: ['https://youtube.com/watch?v=abc']},
      {args: ['https://youtube.com/Playlist?list=kweh']},
    ],
    slots: {
      mode: 'album',
    },
  });

  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/']},
    ],
  });
});