« get me outta code hell

generateAdditionalFilesList.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/generateAdditionalFilesList.js
blob: ce876d8d01a3d0510ae4c2596761a8d39bf66a15 (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
import t from 'tap';
import {testContentFunctions} from '../lib/content-function.js';

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

  evaluate.snapshot('no additional files', {
    name: 'generateAdditionalFilesList',
    args: [[]],
  });

  evaluate.snapshot('basic behavior', {
    name: 'generateAdditionalFilesList',
    args: [
      [
        {
          title: 'SBURB Wallpaper',
          files: [
            'sburbwp_1280x1024.jpg',
            'sburbwp_1440x900.jpg',
            'sburbwp_1920x1080.jpg',
          ],
        },
        {
          title: 'Fake Section',
          description: 'Ooo, what happens if there are NO file links provided?',
          files: [
            'oops.mp3',
            'Internet Explorer.gif',
            'daisy.mp3',
          ],
        },
        {
          title: 'Alternate Covers',
          description: 'This is just an example description.',
          files: [
            'Homestuck_Vol4_alt1.jpg',
            'Homestuck_Vol4_alt2.jpg',
            'Homestuck_Vol4_alt3.jpg',
          ],
        },
      ],
    ],
    postprocess: template => template
      .slot('additionalFileLinks', {
        'sburbwp_1280x1024.jpg': 'link to 1280x1024',
        'sburbwp_1440x900.jpg': 'link to 1440x900',
        'sburbwp_1920x1080.jpg': null,
        'Homestuck_Vol4_alt1.jpg': 'link to alt1',
        'Homestuck_Vol4_alt2.jpg': null,
        'Homestuck_Vol4_alt3.jpg': 'link to alt3',
      })
      .slot('additionalFileSizes', {
        'sburbwp_1280x1024.jpg': 2500,
        'sburbwp_1440x900.jpg': null,
        'sburbwp_1920x1080.jpg': null,
        'Internet Explorer.gif': 1,
        'Homestuck_Vol4_alt1.jpg': 1234567,
        'Homestuck_Vol4_alt2.jpg': 1234567,
        'Homestuck_Vol4_alt3.jpg': 1234567,
      }),
  });
});