generateTrackCoverArtwork.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. artTags: [
  13. {name: 'Damara', directory: 'damara', isContentWarning: false},
  14. {name: 'Cronus', directory: 'cronus', isContentWarning: false},
  15. {name: 'Bees', directory: 'bees', isContentWarning: false},
  16. {name: 'creepy crawlies', isContentWarning: true},
  17. ],
  18. };
  19. const track1 = {
  20. directory: 'beesmp3',
  21. hasUniqueCoverArt: true,
  22. coverArtFileExtension: 'jpg',
  23. artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}],
  24. album,
  25. };
  26. const track2 = {
  27. directory: 'fake-bonus-track',
  28. hasUniqueCoverArt: false,
  29. album,
  30. };
  31. evaluate.snapshot('display: primary - unique art', {
  32. name: 'generateTrackCoverArtwork',
  33. args: [track1],
  34. slots: {mode: 'primary'},
  35. });
  36. evaluate.snapshot('display: thumbnail - unique art', {
  37. name: 'generateTrackCoverArtwork',
  38. args: [track1],
  39. slots: {mode: 'thumbnail'},
  40. });
  41. evaluate.snapshot('display: primary - no unique art', {
  42. name: 'generateTrackCoverArtwork',
  43. args: [track2],
  44. slots: {mode: 'primary'},
  45. });
  46. evaluate.snapshot('display: thumbnail - no unique art', {
  47. name: 'generateTrackCoverArtwork',
  48. args: [track2],
  49. slots: {mode: 'thumbnail'},
  50. });
  51. });