From 004ff284cb54be664fd57337e3ab0a6ca8c607b3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 24 Jun 2023 18:14:25 -0300 Subject: test: generateAlbumTrackList: snapshot dependencies too --- test/snapshot/generateAlbumTrackList.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'test/snapshot') 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, }], -- cgit 1.3.0-6-gf8a5