generateAlbumSecondaryNav.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import t from 'tap';
  2. import {testContentFunctions} from '#test-lib';
  3. testContentFunctions(t, 'generateAlbumSecondaryNav (snapshot)', async (t, evaluate) => {
  4. await evaluate.load();
  5. let album, group1, group2;
  6. group1 = {name: 'VCG', directory: 'vcg', color: '#abcdef'};
  7. group2 = {name: 'Bepis', directory: 'bepis', color: '#123456'};
  8. album = {
  9. name: 'Album',
  10. directory: 'album',
  11. date: new Date('2010-04-13'),
  12. groups: [group1, group2],
  13. };
  14. group1.albums = [
  15. {name: 'First', directory: 'first', date: new Date('2010-04-10')},
  16. album,
  17. {name: 'Last', directory: 'last', date: new Date('2010-06-12')},
  18. ];
  19. group2.albums = [
  20. album,
  21. {name: 'Second', directory: 'second', date: new Date('2011-04-13')},
  22. ];
  23. evaluate.snapshot('basic behavior, mode: album', {
  24. name: 'generateAlbumSecondaryNav',
  25. args: [album],
  26. slots: {mode: 'album'},
  27. });
  28. evaluate.snapshot('basic behavior, mode: track', {
  29. name: 'generateAlbumSecondaryNav',
  30. args: [album],
  31. slots: {mode: 'track'},
  32. });
  33. album = {
  34. date: null,
  35. groups: [group1, group2],
  36. };
  37. group1.albums = [
  38. ...group1.albums,
  39. album,
  40. ];
  41. evaluate.snapshot('dateless album in mixed group', {
  42. name: 'generateAlbumSecondaryNav',
  43. args: [album],
  44. slots: {mode: 'album'},
  45. });
  46. });