diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-06-24 18:14:25 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-06-24 18:14:25 -0300 |
commit | 004ff284cb54be664fd57337e3ab0a6ca8c607b3 (patch) | |
tree | 90fa1e71e0fd3719c425d2d9756e98a360966fad | |
parent | 13552d0c672984611cf4c64641b8fec971128b4a (diff) |
test: generateAlbumTrackList: snapshot dependencies too
-rw-r--r-- | tap-snapshots/test/snapshot/generateAlbumTrackList.js.test.cjs | 16 | ||||
-rw-r--r-- | test/snapshot/generateAlbumTrackList.js | 30 |
2 files changed, 24 insertions, 22 deletions
diff --git a/tap-snapshots/test/snapshot/generateAlbumTrackList.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumTrackList.js.test.cjs index 14316988..c1248814 100644 --- a/tap-snapshots/test/snapshot/generateAlbumTrackList.js.test.cjs +++ b/tap-snapshots/test/snapshot/generateAlbumTrackList.js.test.cjs @@ -7,10 +7,10 @@ 'use strict' exports[`test/snapshot/generateAlbumTrackList.js TAP generateAlbumTrackList (snapshot) > basic behavior, default track section 1`] = ` <ul> - <li>Item: Track 1</li> - <li>Item: Track 2</li> - <li>Item: Track 3</li> - <li>Item: Track 4</li> + <li>(0:20) <a href="track/t1/">Track 1</a></li> + <li>(0:30) <a href="track/t2/">Track 2</a></li> + <li>(0:40) <a href="track/t3/">Track 3</a></li> + <li>(0:05) <a href="track/t4/">Track 4</a> <span class="by">by <a href="artist/apricot/">Apricot</a> and <a href="artist/peach/">Peach</a></span></li> </ul> ` @@ -19,12 +19,12 @@ exports[`test/snapshot/generateAlbumTrackList.js TAP generateAlbumTrackList (sna <dt class="content-heading" tabindex="0">First section (~1:30):</dt> <dd> <ul> - <li>Item: Track 1</li> - <li>Item: Track 2</li> - <li>Item: Track 3</li> + <li>(0:20) <a href="track/t1/">Track 1</a></li> + <li>(0:30) <a href="track/t2/">Track 2</a></li> + <li>(0:40) <a href="track/t3/">Track 3</a></li> </ul> </dd> <dt class="content-heading" tabindex="0">Second section (0:05):</dt> - <dd><ul><li>Item: Track 4</li></ul></dd> + <dd><ul><li>(0:05) <a href="track/t4/">Track 4</a> <span class="by">by <a href="artist/apricot/">Apricot</a> and <a href="artist/peach/">Peach</a></span></li></ul></dd> </dl> ` diff --git a/test/snapshot/generateAlbumTrackList.js b/test/snapshot/generateAlbumTrackList.js index 055f189e..3fc95716 100644 --- a/test/snapshot/generateAlbumTrackList.js +++ b/test/snapshot/generateAlbumTrackList.js @@ -2,27 +2,28 @@ import t from 'tap'; import {testContentFunctions} from '../lib/content-function.js'; testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) => { - await evaluate.load({ - mock: { - generateAlbumTrackListItem: { - extraDependencies: ['html'], - data: track => track.name, - generate: (name, {html}) => - html.tag('li', `Item: ${name}`), - }, - }, - }); + await evaluate.load(); + + const contribs1 = [ + {who: {name: 'Apricot', directory: 'apricot', urls: null}}, + ]; + + const contribs2 = [ + {who: {name: 'Apricot', directory: 'apricot', urls: null}}, + {who: {name: 'Peach', directory: 'peach', urls: ['https://peach.bandcamp.com/']}}, + ]; const tracks = [ - {name: 'Track 1', duration: 20}, - {name: 'Track 2', duration: 30}, - {name: 'Track 3', duration: 40}, - {name: 'Track 4', duration: 5}, + {name: 'Track 1', directory: 't1', duration: 20, artistContribs: contribs1}, + {name: 'Track 2', directory: 't2', duration: 30, artistContribs: contribs1}, + {name: 'Track 3', directory: 't3', duration: 40, artistContribs: contribs1}, + {name: 'Track 4', directory: 't4', duration: 5, artistContribs: contribs2}, ]; evaluate.snapshot('basic behavior, with track sections', { name: 'generateAlbumTrackList', args: [{ + artistContribs: contribs1, trackSections: [ {name: 'First section', tracks: tracks.slice(0, 3)}, {name: 'Second section', tracks: tracks.slice(3)}, @@ -34,6 +35,7 @@ testContentFunctions(t, 'generateAlbumTrackList (snapshot)', async (t, evaluate) evaluate.snapshot('basic behavior, default track section', { name: 'generateAlbumTrackList', args: [{ + artistContribs: contribs1, trackSections: [{isDefaultTrackSection: true, tracks}], tracks, }], |