From 86c2e69f0df5bdb77c18af9e612a30fbea3d9c67 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 13 Jun 2023 19:03:08 -0300 Subject: test: generate{Album,Track}CoverArtwork (snapshot) --- .../snapshot/generateAlbumCoverArtwork.js.test.cjs | 32 +++++++++++ .../snapshot/generateTrackCoverArtwork.js.test.cjs | 43 +++++++++++++++ test/snapshot/generateAlbumCoverArtwork.js | 35 ++++++++++++ test/snapshot/generateTrackCoverArtwork.js | 63 ++++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 tap-snapshots/test/snapshot/generateAlbumCoverArtwork.js.test.cjs create mode 100644 tap-snapshots/test/snapshot/generateTrackCoverArtwork.js.test.cjs create mode 100644 test/snapshot/generateAlbumCoverArtwork.js create mode 100644 test/snapshot/generateTrackCoverArtwork.js diff --git a/tap-snapshots/test/snapshot/generateAlbumCoverArtwork.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumCoverArtwork.js.test.cjs new file mode 100644 index 00000000..d787df68 --- /dev/null +++ b/tap-snapshots/test/snapshot/generateAlbumCoverArtwork.js.test.cjs @@ -0,0 +1,32 @@ +/* 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/generateAlbumCoverArtwork.js TAP generateAlbumCoverArtwork (snapshot) > display: primary 1`] = ` +
+ +
+
+
+
+ + + cw: creepy crawlies +
+ click to show +
+
+
+
+
+
+

Tags: Damara, Cronus, Bees

+
+` + +exports[`test/snapshot/generateAlbumCoverArtwork.js TAP generateAlbumCoverArtwork (snapshot) > display: thumbnail 1`] = ` +
+` diff --git a/tap-snapshots/test/snapshot/generateTrackCoverArtwork.js.test.cjs b/tap-snapshots/test/snapshot/generateTrackCoverArtwork.js.test.cjs new file mode 100644 index 00000000..92216a89 --- /dev/null +++ b/tap-snapshots/test/snapshot/generateTrackCoverArtwork.js.test.cjs @@ -0,0 +1,43 @@ +/* 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/generateTrackCoverArtwork.js TAP generateTrackCoverArtwork (snapshot) > display: primary - no unique art 1`] = ` +
+ +
+
+
+
+ + + cw: creepy crawlies +
+ click to show +
+
+
+
+
+
+

Tags: Damara, Cronus, Bees

+
+` + +exports[`test/snapshot/generateTrackCoverArtwork.js TAP generateTrackCoverArtwork (snapshot) > display: primary - unique art 1`] = ` +
+
+

Tags: Bees

+
+` + +exports[`test/snapshot/generateTrackCoverArtwork.js TAP generateTrackCoverArtwork (snapshot) > display: thumbnail - no unique art 1`] = ` +
+` + +exports[`test/snapshot/generateTrackCoverArtwork.js TAP generateTrackCoverArtwork (snapshot) > display: thumbnail - unique art 1`] = ` +
+` diff --git a/test/snapshot/generateAlbumCoverArtwork.js b/test/snapshot/generateAlbumCoverArtwork.js new file mode 100644 index 00000000..015838c7 --- /dev/null +++ b/test/snapshot/generateAlbumCoverArtwork.js @@ -0,0 +1,35 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateAlbumCoverArtwork (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + const extraDependencies = { + getSizeOfImageFile: () => 0, + }; + + const album = { + directory: 'bee-forus-seatbelt-safebee', + coverArtFileExtension: 'png', + artTags: [ + {name: 'Damara', directory: 'damara', isContentWarning: false}, + {name: 'Cronus', directory: 'cronus', isContentWarning: false}, + {name: 'Bees', directory: 'bees', isContentWarning: false}, + {name: 'creepy crawlies', isContentWarning: true}, + ], + }; + + evaluate.snapshot('display: primary', { + name: 'generateAlbumCoverArtwork', + args: [album], + slots: {displayMode: 'primary'}, + extraDependencies, + }); + + evaluate.snapshot('display: thumbnail', { + name: 'generateAlbumCoverArtwork', + args: [album], + slots: {displayMode: 'thumbnail'}, + extraDependencies, + }); +}); diff --git a/test/snapshot/generateTrackCoverArtwork.js b/test/snapshot/generateTrackCoverArtwork.js new file mode 100644 index 00000000..88ff75dd --- /dev/null +++ b/test/snapshot/generateTrackCoverArtwork.js @@ -0,0 +1,63 @@ +import t from 'tap'; +import {testContentFunctions} from '../lib/content-function.js'; + +testContentFunctions(t, 'generateTrackCoverArtwork (snapshot)', async (t, evaluate) => { + await evaluate.load(); + + const extraDependencies = { + getSizeOfImageFile: () => 0, + }; + + const album = { + directory: 'bee-forus-seatbelt-safebee', + coverArtFileExtension: 'png', + artTags: [ + {name: 'Damara', directory: 'damara', isContentWarning: false}, + {name: 'Cronus', directory: 'cronus', isContentWarning: false}, + {name: 'Bees', directory: 'bees', isContentWarning: false}, + {name: 'creepy crawlies', isContentWarning: true}, + ], + }; + + const track1 = { + directory: 'beesmp3', + hasUniqueCoverArt: true, + coverArtFileExtension: 'jpg', + artTags: [{name: 'Bees', directory: 'bees', isContentWarning: false}], + album, + }; + + const track2 = { + directory: 'fake-bonus-track', + hasUniqueCoverArt: false, + album, + }; + + evaluate.snapshot('display: primary - unique art', { + name: 'generateTrackCoverArtwork', + args: [track1], + slots: {displayMode: 'primary'}, + extraDependencies, + }); + + evaluate.snapshot('display: thumbnail - unique art', { + name: 'generateTrackCoverArtwork', + args: [track1], + slots: {displayMode: 'thumbnail'}, + extraDependencies, + }); + + evaluate.snapshot('display: primary - no unique art', { + name: 'generateTrackCoverArtwork', + args: [track2], + slots: {displayMode: 'primary'}, + extraDependencies, + }); + + evaluate.snapshot('display: thumbnail - no unique art', { + name: 'generateTrackCoverArtwork', + args: [track2], + slots: {displayMode: 'thumbnail'}, + extraDependencies, + }); +}); -- cgit 1.3.0-6-gf8a5