« get me outta code hell

generateAlbumSecondaryNav.js « snapshot « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/snapshot/generateAlbumSecondaryNav.js
blob: 2495bc4a1c2059e5311446f9f20e7ff283ca7d71 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import t from 'tap';
import {testContentFunctions} from '#test-lib';

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

  let album, anotherAlbum, group1, group2;

  group1 = {
    name: 'VCG',
    directory: 'vcg',
    color: '#abcdef',
    serieses: [],
  };

  group2 = {
    name: 'Bepis',
    directory: 'bepis',
    color: '#123456',
    serieses: [],
  };

  album = {
    name: 'Album',
    directory: 'album',
    date: new Date('2010-04-13'),
    groups: [group1, group2],
  };

  anotherAlbum = {
    name: 'Last',
    directory: 'last',
    date: new Date('2010-06-12'),
  };

  group1.albums = [
    {
      name: 'First',
      directory: 'first',
      date: new Date('2010-04-10'),
    },
    album,
    anotherAlbum,
  ];

  group1.serieses = [
    {
      name: 'Series',
      albums: [album, anotherAlbum],
      group: group1,
    },
  ];

  group2.albums = [
    album,
    {
      name: 'Second',
      directory: 'second',
      date: new Date('2011-04-13'),
    },
  ];

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

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

  album = {
    date: null,
    groups: [group1, group2],
  };

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

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