« get me outta code hell

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

testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, evaluate) => {
  await evaluate.load({
    mock: {
      ...evaluate.mock.transformContent,
    },
  });

  let album, group;

  album = {
    date: new Date('2010-04-13'),
  };

  group = {
    name: 'VCG',
    directory: 'vcg',
    descriptionShort: 'Very cool group.',
    urls: ['https://vcg.bandcamp.com/', 'https://youtube.com/@vcg'],
    albums: [
      {name: 'First', directory: 'first', date: new Date('2010-04-10')},
      album,
      {name: 'Last', directory: 'last', date: new Date('2010-06-12')},
    ],
  };

  evaluate.snapshot('basic behavior, mode: album', {
    name: 'generateAlbumSidebarGroupBox',
    args: [album, group],
    slots: {mode: 'album'},
  });

  evaluate.snapshot('basic behavior, mode: track', {
    name: 'generateAlbumSidebarGroupBox',
    args: [album, group],
    slots: {mode: 'track'},
  });

  album = {
    date: null,
  };

  group.albums = [
    ...group.albums,
    album,
  ];

  evaluate.snapshot('dateless album in mixed group', {
    name: 'generateAlbumSidebarGroupBox',
    args: [album, group],
    slots: {mode: 'album'},
  });
});