generateAlbumSidebarGroupBox.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import t from 'tap';
  2. import {testContentFunctions} from '../lib/content-function.js';
  3. testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, evaluate) => {
  4. await evaluate.load({
  5. mock: {
  6. ...evaluate.mock.transformContent,
  7. },
  8. });
  9. let album, group;
  10. album = {
  11. date: new Date('2010-04-13'),
  12. };
  13. group = {
  14. name: 'VCG',
  15. directory: 'vcg',
  16. descriptionShort: 'Very cool group.',
  17. urls: ['https://vcg.bandcamp.com/', 'https://youtube.com/@vcg'],
  18. albums: [
  19. {name: 'First', directory: 'first', date: new Date('2010-04-10')},
  20. album,
  21. {name: 'Last', directory: 'last', date: new Date('2010-06-12')},
  22. ],
  23. };
  24. evaluate.snapshot('basic behavior, mode: album', {
  25. name: 'generateAlbumSidebarGroupBox',
  26. args: [album, group],
  27. slots: {mode: 'album'},
  28. });
  29. evaluate.snapshot('basic behavior, mode: track', {
  30. name: 'generateAlbumSidebarGroupBox',
  31. args: [album, group],
  32. slots: {mode: 'track'},
  33. });
  34. album = {
  35. date: null,
  36. };
  37. group.albums = [
  38. ...group.albums,
  39. album,
  40. ];
  41. evaluate.snapshot('dateless album in mixed group', {
  42. name: 'generateAlbumSidebarGroupBox',
  43. args: [album, group],
  44. slots: {mode: 'album'},
  45. });
  46. });