generateTrackCoverArtwork.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import t from 'tap';
  2. import {testContentFunctions} from '#test-lib';
  3. testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => {
  4. await evaluate.load({
  5. mock: {
  6. image: evaluate.stubContentFunction('image'),
  7. },
  8. });
  9. const album = {
  10. directory: 'bee-forus-seatbelt-safebee',
  11. coverArtFileExtension: 'png',
  12. coverArtDimensions: [400, 300],
  13. artTags: [
  14. {name: 'Damara', directory: 'damara', isContentWarning: false},
  15. {name: 'Cronus', directory: 'cronus', isContentWarning: false},
  16. {name: 'Bees', directory: 'bees', isContentWarning: false},
  17. {name: 'creepy crawlies', isContentWarning: true},
  18. ],
  19. };
  20. const track1 = {
  21. directory: 'beesmp3',
  22. hasUniqueCoverArt: true,
  23. coverArtFileExtension: 'jpg',
  24. coverArtDimensions: null,
  25. color: '#f28514',
  26. artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}],
  27. album,
  28. };
  29. const track2 = {
  30. directory: 'fake-bonus-track',
  31. hasUniqueCoverArt: false,
  32. color: '#abcdef',
  33. album,
  34. };
  35. evaluate.snapshot('display: primary - unique art', {
  36. name: 'generateTrackCoverArtwork',
  37. args: [track1],
  38. slots: {mode: 'primary'},
  39. });
  40. evaluate.snapshot('display: thumbnail - unique art', {
  41. name: 'generateTrackCoverArtwork',
  42. args: [track1],
  43. slots: {mode: 'thumbnail'},
  44. });
  45. evaluate.snapshot('display: primary - no unique art', {
  46. name: 'generateTrackCoverArtwork',
  47. args: [track2],
  48. slots: {mode: 'primary'},
  49. });
  50. evaluate.snapshot('display: thumbnail - no unique art', {
  51. name: 'generateTrackCoverArtwork',
  52. args: [track2],
  53. slots: {mode: 'thumbnail'},
  54. });
  55. });