generateTrackReleaseInfo.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import t from 'tap';
  2. import {testContentFunctions} from '../lib/content-function.js';
  3. testContentFunctions(t, 'generateTrackReleaseInfo (snapshot)', async (t, evaluate) => {
  4. await evaluate.load();
  5. const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, what: null}];
  6. const coverArtistContribs = [{who: {name: 'Alpaca', directory: 'alpaca', urls: null}, what: '🔥'}];
  7. evaluate.snapshot('basic behavior', {
  8. name: 'generateTrackReleaseInfo',
  9. args: [{
  10. artistContribs,
  11. name: 'An Apple Disaster!!',
  12. date: new Date('2011-11-30'),
  13. duration: 58,
  14. urls: ['https://soundcloud.com/foo', 'https://youtube.com/watch?v=bar'],
  15. }],
  16. });
  17. const sparse = {
  18. artistContribs,
  19. name: 'Suspicious Track',
  20. date: null,
  21. duration: null,
  22. urls: [],
  23. };
  24. evaluate.snapshot('reduced details', {
  25. name: 'generateTrackReleaseInfo',
  26. args: [sparse],
  27. });
  28. evaluate.snapshot('cover artist contribs, non-unique', {
  29. name: 'generateTrackReleaseInfo',
  30. args: [{
  31. ...sparse,
  32. coverArtistContribs,
  33. hasUniqueCoverArt: false,
  34. }],
  35. });
  36. evaluate.snapshot('cover artist contribs, unique', {
  37. name: 'generateTrackReleaseInfo',
  38. args: [{
  39. ...sparse,
  40. coverArtistContribs,
  41. hasUniqueCoverArt: true,
  42. }],
  43. });
  44. });