From 5111e6be757ca89d27876ddb68de4b916b23bfe1 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jun 2023 18:36:53 -0300 Subject: test: generateAlbumReleaseInfo (snapshot) --- test/snapshot/generateAlbumReleaseInfo.js | 74 +++++++++++++++++++++++++++++++ test/snapshot/generateTrackReleaseInfo.js | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/snapshot/generateAlbumReleaseInfo.js (limited to 'test/snapshot') diff --git a/test/snapshot/generateAlbumReleaseInfo.js b/test/snapshot/generateAlbumReleaseInfo.js new file mode 100644 index 00000000..cbee5eb7 --- /dev/null +++ b/test/snapshot/generateAlbumReleaseInfo.js @@ -0,0 +1,74 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateAlbumReleaseInfo (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + evaluate.snapshot('basic behavior', { + name: 'generateAlbumReleaseInfo', + args: [{ + artistContribs: [ + {who: {name: 'Toby Fox', directory: 'toby-fox'}, what: 'music probably'}, + {who: {name: 'Tensei', directory: 'tensei', urls: ['https://tenseimusic.bandcamp.com/']}, what: 'hot jams'}, + ], + + coverArtistContribs: [ + {who: {name: 'Hanni Brosh', directory: 'hb'}, what: null}, + ], + + wallpaperArtistContribs: [ + {who: {name: 'Hanni Brosh', directory: 'hb'}, what: null}, + {who: {name: 'Niklink', directory: 'niklink'}, what: 'edits'}, + ], + + bannerArtistContribs: [ + {who: {name: 'Hanni Brosh', directory: 'hb'}, what: null}, + {who: {name: 'Niklink', directory: 'niklink'}, what: 'edits'}, + ], + + name: 'AlterniaBound', + date: new Date('March 14, 2011'), + coverArtDate: new Date('April 1, 1991'), + urls: [ + 'https://homestuck.bandcamp.com/album/alterniabound-with-alternia', + 'https://www.youtube.com/playlist?list=PLnVpmehyaOFZWO9QOZmD6A3TIK0wZ6xE2', + 'https://www.youtube.com/watch?v=HO5V2uogkYc', + ], + + tracks: [{duration: 253}, {duration: 372}], + }], + }); + + const sparse = { + artistContribs: [], + coverArtistContribs: [], + wallpaperArtistContribs: [], + bannerArtistContribs: [], + + name: 'Suspicious Album', + urls: [], + tracks: [], + }; + + evaluate.snapshot('reduced details', { + name: 'generateAlbumReleaseInfo', + args: [sparse], + }); + + evaluate.snapshot('URLs only', { + name: 'generateAlbumReleaseInfo', + args: [{ + ...sparse, + urls: ['https://homestuck.bandcamp.com/foo', 'https://soundcloud.com/bar'], + }], + }); + + evaluate.snapshot('equal cover art date', { + name: 'generateAlbumReleaseInfo', + args: [{ + ...sparse, + date: new Date('2020-04-13'), + coverArtDate: new Date('2020-04-13'), + }], + }); +}); diff --git a/test/snapshot/generateTrackReleaseInfo.js b/test/snapshot/generateTrackReleaseInfo.js index c9c40684..dd7ebd8e 100644 --- a/test/snapshot/generateTrackReleaseInfo.js +++ b/test/snapshot/generateTrackReleaseInfo.js @@ -1,7 +1,7 @@ import t from 'tap'; import {testContentFunctions} from '../lib/content-function.js'; -testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => { +testContentFunctions(t, 'generateTrackReleaseInfo (snapshot)', async (t, evaluate) => { await evaluate.load(); const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox'}, what: null}]; -- cgit 1.3.0-6-gf8a5