From afe95ef37cf2bbb486515d2f2cc46522f582daaf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 14 Jun 2023 13:18:51 -0300 Subject: test: generateAlbumSidebarGroupBox (snapshot) --- .../generateAlbumSidebarGroupBox.js.test.cjs | 25 ++++++++++ test/snapshot/generateAlbumSidebarGroupBox.js | 55 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs create mode 100644 test/snapshot/generateAlbumSidebarGroupBox.js diff --git a/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs new file mode 100644 index 00000000..3be84969 --- /dev/null +++ b/tap-snapshots/test/snapshot/generateAlbumSidebarGroupBox.js.test.cjs @@ -0,0 +1,25 @@ +/* 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/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > basic behavior, mode: album 1`] = ` +

VCG

+Very cool group. +

Visit on Bandcamp or YouTube.

+ + +` + +exports[`test/snapshot/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > basic behavior, mode: track 1`] = ` +

VCG

+

Visit on Bandcamp or YouTube.

+` + +exports[`test/snapshot/generateAlbumSidebarGroupBox.js TAP generateAlbumSidebarGroupBox (snapshot) > dateless album in mixed group 1`] = ` +

VCG

+Very cool group. +

Visit on Bandcamp or YouTube.

+` diff --git a/test/snapshot/generateAlbumSidebarGroupBox.js b/test/snapshot/generateAlbumSidebarGroupBox.js new file mode 100644 index 00000000..52348230 --- /dev/null +++ b/test/snapshot/generateAlbumSidebarGroupBox.js @@ -0,0 +1,55 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateAlbumSidebarGroupBox (snapshot)', async (t, evaluate) => { + await evaluate.load({ + mock: { + ...evaluate.mock.transformContent, + }, + }); + + let album, group; + + album = { + date: new Date('2010-04-13'), + }; + + group = { + name: 'VCG', + directory: 'vcg', + descriptionShort: 'Very cool group.', + urls: ['https://vcg.bandcamp.com/', 'https://youtube.com/@vcg'], + albums: [ + {name: 'First', directory: 'first', date: new Date('2010-04-10')}, + album, + {name: 'Last', directory: 'last', date: new Date('2010-06-12')}, + ], + }; + + evaluate.snapshot('basic behavior, mode: album', { + name: 'generateAlbumSidebarGroupBox', + args: [album, group], + slots: {mode: 'album'}, + }); + + evaluate.snapshot('basic behavior, mode: track', { + name: 'generateAlbumSidebarGroupBox', + args: [album, group], + slots: {mode: 'track'}, + }); + + album = { + date: null, + }; + + group.albums = [ + ...group.albums, + album, + ]; + + evaluate.snapshot('dateless album in mixed group', { + name: 'generateAlbumSidebarGroupBox', + args: [album, group], + slots: {mode: 'album'}, + }); +}); -- cgit 1.3.0-6-gf8a5