« get me outta code hell

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

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

  const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, what: null}];
  const coverArtistContribs = [{who: {name: 'Alpaca', directory: 'alpaca', urls: null}, what: '🔥'}];

  evaluate.snapshot('basic behavior', {
    name: 'generateTrackReleaseInfo',
    args: [{
      artistContribs,
      name: 'An Apple Disaster!!',
      date: new Date('2011-11-30'),
      duration: 58,
      urls: ['https://soundcloud.com/foo', 'https://youtube.com/watch?v=bar'],
    }],
  });

  const sparse = {
    artistContribs,
    name: 'Suspicious Track',
    date: null,
    duration: null,
    urls: [],
  };

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

  evaluate.snapshot('cover artist contribs, non-unique', {
    name: 'generateTrackReleaseInfo',
    args: [{
      ...sparse,
      coverArtistContribs,
      hasUniqueCoverArt: false,
    }],
  });

  evaluate.snapshot('cover artist contribs, unique', {
    name: 'generateTrackReleaseInfo',
    args: [{
      ...sparse,
      coverArtistContribs,
      hasUniqueCoverArt: true,
    }],
  });
});