« 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: 92cb8947f16d4b4602c6a1873187249f1a794aee (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import t from 'tap';
import {testContentFunctions} from '#test-lib';

testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => {
  await evaluate.load();

  evaluate.snapshot('unknown domain (arbitrary world wide web path)', {
    name: 'linkExternal',
    args: ['https://snoo.ping.as/usual/i/see/'],
  });

  const urlsToArgs = urls =>
    urls.map(url => ({args: [url]}));

  const quickSnapshot = (message, urls, slots) =>
    evaluate.snapshot(message, {
      name: 'linkExternal',
      slots,
      multiple: urlsToArgs(urls),
    });

  const quickSnapshotAllStyles = (context, urls) => {
    for (const style of ['platform', 'normal', 'compact']) {
      const message = `context: ${context}, style: ${style}`;
      quickSnapshot(message, urls, {context, style});
    }
  };

  quickSnapshotAllStyles('generic', [
    'https://homestuck.bandcamp.com/',
    'https://soundcloud.com/plazmataz',
    'https://aeritus.tumblr.com/',
    'https://twitter.com/awkwarddoesart',
    'https://www.deviantart.com/chesswanderlust-sama',
    'https://en.wikipedia.org/wiki/Haydn_Quartet_(vocal_ensemble)',
    'https://www.poetryfoundation.org/poets/christina-rossetti',
    'https://www.instagram.com/levc_egm/',
    'https://www.patreon.com/CecilyRenns',
    '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/',

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

  quickSnapshotAllStyles('album', [
    'https://youtu.be/abc',
    'https://youtube.com/watch?v=abc',
    'https://youtube.com/Playlist?list=kweh',
  ]);

  quickSnapshotAllStyles('flash', [
    'https://www.bgreco.net/hsflash/002238.html',
    'https://homestuck.com/story/1234',
    'https://homestuck.com/story/pony',
    'https://www.youtube.com/watch?v=wKgOp3Kg2wI',
    'https://youtu.be/IOcvkkklWmY',
    'https://some.external.site/foo/bar/',
  ]);
});