« get me outta code hell

linkContribution.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/linkContribution.js
blob: 5844b0b96b01b0130bed3661fe362a3736e59c5d (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
69
70
71
72
73
import t from 'tap';
import {testContentFunctions} from '#test-lib';

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

  const quickSnapshot = (message, slots) =>
    evaluate.snapshot(message, {
      name: 'linkContribution',
      multiple: [
        {args: [
          {artist: {
            name: 'Clark Powell',
            directory: 'clark-powell',
            urls: ['https://soundcloud.com/plazmataz'],
          }, annotation: null},
        ]},
        {args: [
          {artist: {
            name: 'Grounder & Scratch',
            directory: 'the-big-baddies',
            urls: [],
          }, annotation: 'Snooping'},
        ]},
        {args: [
          {artist: {
            name: 'Toby Fox',
            directory: 'toby-fox',
            urls: ['https://tobyfox.bandcamp.com/', 'https://toby.fox/'],
          }, annotation: 'Arrangement'},
        ]},
      ],
      slots,
    });

  quickSnapshot('showContribution & showExternalLinks', {
    showContribution: true,
    showExternalLinks: true,
  });

  quickSnapshot('only showContribution', {
    showContribution: true,
  });

  quickSnapshot('only showExternalLinks', {
    showExternalLinks: true,
  });

  quickSnapshot('no accents', {});

  evaluate.snapshot('loads of links', {
    name: 'linkContribution',
    args: [
      {artist: {name: 'Lorem Ipsum Lover', directory: 'lorem-ipsum-lover', urls: [
        'https://loremipsum.io',
        'https://loremipsum.io/generator/',
        'https://loremipsum.io/#meaning',
        'https://loremipsum.io/#usage-and-examples',
        'https://loremipsum.io/#controversy',
        'https://loremipsum.io/#when-to-use-lorem-ipsum',
        'https://loremipsum.io/#lorem-ipsum-all-the-things',
        'https://loremipsum.io/#original-source',
      ]}, annotation: null},
    ],
    slots: {showExternalLinks: true},
  });

  quickSnapshot('no preventWrapping', {
    showContribution: true,
    showExternalLinks: true,
    preventWrapping: false,
  });
});