generateAlbumReleaseInfo.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import t from 'tap';
  2. import {testContentFunctions} from '#test-lib';
  3. testContentFunctions(t, 'generateAlbumReleaseInfo (snapshot)', async (t, evaluate) => {
  4. await evaluate.load();
  5. evaluate.snapshot('basic behavior', {
  6. name: 'generateAlbumReleaseInfo',
  7. args: [{
  8. artistContribs: [
  9. {artist: {name: 'Toby Fox', directory: 'toby-fox', urls: null}, annotation: 'music probably'},
  10. {artist: {name: 'Tensei', directory: 'tensei', urls: ['https://tenseimusic.bandcamp.com/']}, annotation: 'hot jams'},
  11. ],
  12. coverArtistContribs: [
  13. {artist: {name: 'Hanni Brosh', directory: 'hb', urls: null}, annotation: null},
  14. ],
  15. wallpaperArtistContribs: [
  16. {artist: {name: 'Hanni Brosh', directory: 'hb', urls: null}, annotation: null},
  17. {artist: {name: 'Niklink', directory: 'niklink', urls: null}, annotation: 'edits'},
  18. ],
  19. bannerArtistContribs: [
  20. {artist: {name: 'Hanni Brosh', directory: 'hb', urls: null}, annotation: null},
  21. {artist: {name: 'Niklink', directory: 'niklink', urls: null}, annotation: 'edits'},
  22. ],
  23. name: 'AlterniaBound',
  24. date: new Date('March 14, 2011'),
  25. coverArtDate: new Date('April 1, 1991'),
  26. urls: [
  27. 'https://homestuck.bandcamp.com/album/alterniabound-with-alternia',
  28. 'https://www.youtube.com/playlist?list=PLnVpmehyaOFZWO9QOZmD6A3TIK0wZ6xE2',
  29. 'https://www.youtube.com/watch?v=HO5V2uogkYc',
  30. ],
  31. tracks: [{duration: 253}, {duration: 372}],
  32. }],
  33. });
  34. const sparse = {
  35. artistContribs: [],
  36. coverArtistContribs: [],
  37. wallpaperArtistContribs: [],
  38. bannerArtistContribs: [],
  39. name: 'Suspicious Album',
  40. urls: [],
  41. tracks: [],
  42. };
  43. evaluate.snapshot('reduced details', {
  44. name: 'generateAlbumReleaseInfo',
  45. args: [sparse],
  46. });
  47. evaluate.snapshot('URLs only', {
  48. name: 'generateAlbumReleaseInfo',
  49. args: [{
  50. ...sparse,
  51. urls: ['https://homestuck.bandcamp.com/foo', 'https://soundcloud.com/bar'],
  52. }],
  53. });
  54. evaluate.snapshot('equal cover art date', {
  55. name: 'generateAlbumReleaseInfo',
  56. args: [{
  57. ...sparse,
  58. date: new Date('2020-04-13'),
  59. coverArtDate: new Date('2020-04-13'),
  60. }],
  61. });
  62. });