generateAlbumTrackList.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import t from 'tap';
  2. import {testContentFunctions} from '#test-lib';
  3. testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) => {
  4. await evaluate.load();
  5. const contribs1 = [
  6. {who: {name: 'Apricot', directory: 'apricot', urls: null}},
  7. ];
  8. const contribs2 = [
  9. {who: {name: 'Apricot', directory: 'apricot', urls: null}},
  10. {who: {name: 'Peach', directory: 'peach', urls: ['https://peach.bandcamp.com/']}},
  11. ];
  12. const color1 = '#fb07ff';
  13. const color2 = '#ea2e83';
  14. const tracks = [
  15. {name: 'Track 1', directory: 't1', duration: 20, artistContribs: contribs1, color: color1},
  16. {name: 'Track 2', directory: 't2', duration: 30, artistContribs: contribs1, color: color1},
  17. {name: 'Track 3', directory: 't3', duration: 40, artistContribs: contribs1, color: color1},
  18. {name: 'Track 4', directory: 't4', duration: 5, artistContribs: contribs2, color: color2},
  19. ];
  20. evaluate.snapshot('basic behavior, with track sections', {
  21. name: 'generateAlbumTrackList',
  22. args: [{
  23. color: color1,
  24. artistContribs: contribs1,
  25. trackSections: [
  26. {name: 'First section', tracks: tracks.slice(0, 3)},
  27. {name: 'Second section', tracks: tracks.slice(3)},
  28. ],
  29. tracks,
  30. }],
  31. });
  32. evaluate.snapshot('basic behavior, default track section', {
  33. name: 'generateAlbumTrackList',
  34. args: [{
  35. color: color1,
  36. artistContribs: contribs1,
  37. trackSections: [{isDefaultTrackSection: true, tracks}],
  38. tracks,
  39. }],
  40. });
  41. });