« get me outta code hell

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

testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => {
  await evaluate.load({
    mock: {
      image: evaluate.stubContentFunction('image'),
    },
  });

  const album = {
    directory: 'bee-forus-seatbelt-safebee',
    coverArtFileExtension: 'png',
    coverArtDimensions: [400, 300],
    artTags: [
      {name: 'Damara', directory: 'damara', isContentWarning: false},
      {name: 'Cronus', directory: 'cronus', isContentWarning: false},
      {name: 'Bees', directory: 'bees', isContentWarning: false},
      {name: 'creepy crawlies', isContentWarning: true},
    ],
    coverArtistContribs: [
      {artist: {name: 'Circlejourney', directory: 'circlejourney'}},
      {artist: {name: 'magnoliajades', directory: 'magnoliajades'}},
    ],
  };

  const track1 = {
    directory: 'beesmp3',
    hasUniqueCoverArt: true,
    coverArtFileExtension: 'jpg',
    coverArtDimensions: null,
    color: '#f28514',
    artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}],
    coverArtistContribs: [
      {artist: {name: 'Circlejourney', directory: 'circlejourney'}},
    ],
    album,
  };

  const track2 = {
    directory: 'fake-bonus-track',
    hasUniqueCoverArt: false,
    color: '#abcdef',
    album,
  };

  evaluate.snapshot('display: primary-tags - unique art', {
    name: 'generateTrackCoverArtwork',
    args: [track1],
    slots: {mode: 'primary-tags'},
  });

  evaluate.snapshot('display: thumbnail - unique art', {
    name: 'generateTrackCoverArtwork',
    args: [track1],
    slots: {mode: 'thumbnail'},
  });

  evaluate.snapshot('display: primary-tags - no unique art', {
    name: 'generateTrackCoverArtwork',
    args: [track2],
    slots: {mode: 'primary-tags'},
  });

  evaluate.snapshot('display: thumbnail - no unique art', {
    name: 'generateTrackCoverArtwork',
    args: [track2],
    slots: {mode: 'thumbnail'},
  });
});