From afdc1e4bee3eba30a83ec3f71617573331d98169 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jun 2023 13:14:35 -0300 Subject: test: generateTrackReleaseInfo (snapshot) --- .../snapshot/generateTrackReleaseInfo.js.test.cjs | 36 +++++++++++++++ test/snapshot/generateTrackReleaseInfo.js | 51 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs create mode 100644 test/snapshot/generateTrackReleaseInfo.js diff --git a/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs b/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs new file mode 100644 index 00000000..b72680ae --- /dev/null +++ b/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs @@ -0,0 +1,36 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/snapshot/generateTrackReleaseInfo.js TAP linkArtist (snapshot) > basic behavior 1`] = ` +

+ By Toby Fox. +
+ Released 11/29/2011. +
+ Duration: 0:58. +

+

Listen on SoundCloud or YouTube.

+` + +exports[`test/snapshot/generateTrackReleaseInfo.js TAP linkArtist (snapshot) > cover artist contribs, non-unique 1`] = ` +

By Toby Fox.

+

This wiki doesn't have any listening links for Suspicious Track.

+` + +exports[`test/snapshot/generateTrackReleaseInfo.js TAP linkArtist (snapshot) > cover artist contribs, unique 1`] = ` +

+ By Toby Fox. +
+ Cover art by Alpaca (🔥). +

+

This wiki doesn't have any listening links for Suspicious Track.

+` + +exports[`test/snapshot/generateTrackReleaseInfo.js TAP linkArtist (snapshot) > reduced details 1`] = ` +

By Toby Fox.

+

This wiki doesn't have any listening links for Suspicious Track.

+` diff --git a/test/snapshot/generateTrackReleaseInfo.js b/test/snapshot/generateTrackReleaseInfo.js new file mode 100644 index 00000000..c9c40684 --- /dev/null +++ b/test/snapshot/generateTrackReleaseInfo.js @@ -0,0 +1,51 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'linkArtist (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + const artistContribs = [{who: {name: 'Toby Fox', directory: 'toby-fox'}, what: null}]; + const coverArtistContribs = [{who: {name: 'Alpaca', directory: 'alpaca'}, what: '🔥'}]; + + evaluate.snapshot('basic behavior', { + name: 'generateTrackReleaseInfo', + args: [{ + artistContribs, + name: 'An Apple Disaster!!', + date: new Date('2011-11-30'), + duration: 58, + urls: ['https://soundcloud.com/foo', 'https://youtube.com/watch?v=bar'], + }], + }); + + const sparse = { + artistContribs, + name: 'Suspicious Track', + date: null, + duration: null, + urls: [], + }; + + evaluate.snapshot('reduced details', { + name: 'generateTrackReleaseInfo', + args: [sparse], + }); + + evaluate.snapshot('cover artist contribs, non-unique', { + name: 'generateTrackReleaseInfo', + args: [{ + ...sparse, + coverArtistContribs, + hasUniqueCoverArt: false, + }], + }); + + evaluate.snapshot('cover artist contribs, unique', { + name: 'generateTrackReleaseInfo', + args: [{ + ...sparse, + coverArtistContribs, + hasUniqueCoverArt: true, + }], + }); +}); -- cgit 1.3.0-6-gf8a5