« get me outta code hell

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

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

  evaluate.snapshot('basic behavior', {
    name: 'generateAlbumReleaseInfo',
    args: [{
      artistContribs: [
        {who: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, what: 'music probably'},
        {who: {name: 'Tensei', directory: 'tensei', urls: ['https://tenseimusic.bandcamp.com/']}, what: 'hot jams'},
      ],

      coverArtistContribs: [
        {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null},
      ],

      wallpaperArtistContribs: [
        {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null},
        {who: {name: 'Niklink', directory: 'niklink', urls: null}, what: 'edits'},
      ],

      bannerArtistContribs: [
        {who: {name: 'Hanni Brosh', directory: 'hb', urls: null}, what: null},
        {who: {name: 'Niklink', directory: 'niklink', urls: null}, what: 'edits'},
      ],

      name: 'AlterniaBound',
      date: new Date('March 14, 2011'),
      coverArtDate: new Date('April 1, 1991'),
      urls: [
        'https://homestuck.bandcamp.com/album/alterniabound-with-alternia',
        'https://www.youtube.com/playlist?list=PLnVpmehyaOFZWO9QOZmD6A3TIK0wZ6xE2',
        'https://www.youtube.com/watch?v=HO5V2uogkYc',
      ],

      tracks: [{duration: 253}, {duration: 372}],
    }],
  });

  const sparse = {
    artistContribs: [],
    coverArtistContribs: [],
    wallpaperArtistContribs: [],
    bannerArtistContribs: [],

    name: 'Suspicious Album',
    urls: [],
    tracks: [],
  };

  evaluate.snapshot('reduced details', {
    name: 'generateAlbumReleaseInfo',
    args: [sparse],
  });

  evaluate.snapshot('URLs only', {
    name: 'generateAlbumReleaseInfo',
    args: [{
      ...sparse,
      urls: ['https://homestuck.bandcamp.com/foo', 'https://soundcloud.com/bar'],
    }],
  });

  evaluate.snapshot('equal cover art date', {
    name: 'generateAlbumReleaseInfo',
    args: [{
      ...sparse,
      date: new Date('2020-04-13'),
      coverArtDate: new Date('2020-04-13'),
    }],
  });
});