« get me outta code hell

test: Album.coverArtFileExtension (unit) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-08 09:12:42 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-08 09:12:42 -0300
commit3344a16a02a2c680d9e9eaf27c81890e17b9b5f4 (patch)
tree2cdb1ad0525542aeb28e511c41ecf6ce42f8c690 /test
parent2ce923876663fcbdd2c9aaec96692592a066436c (diff)
test: Album.coverArtFileExtension (unit)
Most of these currently fail.
Diffstat (limited to 'test')
-rw-r--r--test/unit/data/things/album.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/data/things/album.js b/test/unit/data/things/album.js
index 358abb3b..42f73082 100644
--- a/test/unit/data/things/album.js
+++ b/test/unit/data/things/album.js
@@ -59,3 +59,39 @@ t.test(`Album.coverArtDate`, t => {
   t.equal(album.coverArtDate, null,
     `Album.coverArtDate #6: is null if coverArtistContribs resolves empty`);
 });
+
+t.test(`Album.coverArtFileExtension`, t => {
+  t.plan(5);
+
+  const album = new Album();
+  const {artist, contribs, badContribs} = stubArtistAndContribs();
+
+  linkAndBindWikiData({
+    albumData: [album],
+    artistData: [artist],
+  });
+
+  t.equal(album.coverArtFileExtension, null,
+    `Album.coverArtFileExtension #1: is null if coverArtistContribs empty (1/2)`);
+
+  album.coverArtFileExtension = 'png';
+
+  t.equal(album.coverArtFileExtension, null,
+    `Album.coverArtFileExtension #2: is null if coverArtistContribs empty (2/2)`);
+
+  album.coverArtFileExtension = null;
+  album.coverArtistContribs = contribs;
+
+  t.equal(album.coverArtFileExtension, 'jpg',
+    `Album.coverArtFileExtension #3: defaults to jpg`);
+
+  album.coverArtFileExtension = 'png';
+
+  t.equal(album.coverArtFileExtension, 'png',
+    `Album.coverArtFileExtension #4: is own value`);
+
+  album.coverArtistContribs = badContribs;
+
+  t.equal(album.coverArtFileExtension, null,
+    `Album.coverArtFileExtension #5: is null if coverArtistContribs resolves empty`);
+});