From 5b0cca036702b0726d54f90e407a06a3c80f3d66 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 4 Apr 2023 15:49:14 -0300 Subject: test: generateAlbumTrackListItem (snapshot) --- test/snapshot/generateAlbumTrackListItem.js | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 test/snapshot/generateAlbumTrackListItem.js (limited to 'test/snapshot') diff --git a/test/snapshot/generateAlbumTrackListItem.js b/test/snapshot/generateAlbumTrackListItem.js new file mode 100644 index 00000000..e87c6de0 --- /dev/null +++ b/test/snapshot/generateAlbumTrackListItem.js @@ -0,0 +1,66 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateAlbumTrackListItem (snapshot)', async (t, evaluate) => { + const artist1 = {directory: 'toby-fox', name: 'Toby Fox', urls: ['https://toby.fox/']}; + const artist2 = {directory: 'james-roach', name: 'James Roach'}; + const artist3 = {directory: 'clark-powell', name: 'Clark Powell'}; + const artist4 = {directory: ''} + const albumContribs = [{who: artist1}, {who: artist2}]; + + await evaluate.load(); + + evaluate.snapshot('basic behavior', { + name: 'generateAlbumTrackListItem', + args: [ + { + // Just pretend Hiveswap Act 1 OST doesn't have its own Artists field OK? + // We test that kind of case later! + name: 'Final Spice', + directory: 'final-spice', + duration: 54, + color: '#33cc77', + artistContribs: [ + {who: artist1, what: 'composition & arrangement'}, + {who: artist2, what: 'arrangement'}, + ], + }, + {artistContribs: []}, + ], + }); + + evaluate.snapshot('zero duration, zero artists', { + name: 'generateAlbumTrackListItem', + args: [ + { + name: 'You have got to be about the most superficial commentator on con-langues since the idiotic B. Gilson.', + directory: 'you-have-got-to-be-about-the-most-superficial-commentator-on-con-langues-since-the-idiotic-b-gilson', + duration: 0, + artistContribs: [], + }, + {artistContribs: []}, + ], + }); + + evaluate.snapshot('hide artists if inherited from album', { + name: 'generateAlbumTrackListItem', + multiple: [ + {args: [ + {directory: 'track1', name: 'Same artists, same order', artistContribs: [{who: artist1}, {who: artist2}]}, + {artistContribs: albumContribs}, + ]}, + {args: [ + {directory: 'track2', name: 'Same artists, different order', artistContribs: [{who: artist2}, {who: artist1}]}, + {artistContribs: albumContribs}, + ]}, + {args: [ + {directory: 'track3', name: 'Extra artist', artistContribs: [{who: artist1}, {who: artist2}, {who: artist3}]}, + {artistContribs: albumContribs}, + ]}, + {args: [ + {directory: 'track4', name: 'Missing artist', artistContribs: [{who: artist1}]}, + {artistContribs: albumContribs}, + ]}, + ], + }); +}); -- cgit 1.3.0-6-gf8a5