« 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: f9877aad7fd6ee6210f42f3c5d9a9811bb181d4f (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
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/',
  ]);

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