« get me outta code hell

test: Track.coverArtDate: test contribs lists resolving empty - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-08 09:05:24 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-08 09:05:24 -0300
commit7132dc6df4a2aabcd0c6f445a91bbd988e64623d (patch)
treeab45b266c472d1d6ff720b9270e3a678b9bb4d85 /test/unit/data
parent21a270ca6efa561cad3e87048cf8deb8a166d55f (diff)
test: Track.coverArtDate: test contribs lists resolving empty
Diffstat (limited to 'test/unit/data')
-rw-r--r--test/unit/data/things/track.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js
index bb8d7079..6597c2f9 100644
--- a/test/unit/data/things/track.js
+++ b/test/unit/data/things/track.js
@@ -161,10 +161,10 @@ t.test(`Track.color`, t => {
 });
 
 t.test(`Track.coverArtDate`, t => {
-  t.plan(6);
+  t.plan(8);
 
   const {track, album} = stubTrackAndAlbum();
-  const {artist, contribs} = stubArtistAndContribs();
+  const {artist, contribs, badContribs} = stubArtistAndContribs();
 
   const {XXX_decacheWikiData} = linkAndBindWikiData({
     albumData: [album],
@@ -192,19 +192,32 @@ t.test(`Track.coverArtDate`, t => {
   track.coverArtistContribs = [];
 
   t.equal(track.coverArtDate, null,
-    `coverArtDate #4: is null if track is missing coverArtists`);
+    `coverArtDate #4: is null if track coverArtistContribs empty`);
 
   album.trackCoverArtistContribs = contribs;
 
   XXX_decacheWikiData();
 
   t.same(track.coverArtDate, new Date('2009-09-09'),
-    `coverArtDate #5: is not null if album specifies trackCoverArtistContribs`);
+    `coverArtDate #5: is not null if album trackCoverArtistContribs specified`);
+
+  album.trackCoverArtistContribs = badContribs;
+
+  XXX_decacheWikiData();
 
+  t.equal(track.coverArtDate, null,
+    `coverArtDate #6: is null if album trackCoverArtistContribs resolves empty`);
+
+  track.coverArtistContribs = badContribs;
+
+  t.equal(track.coverArtDate, null,
+    `coverArtDate #7: is null if track coverArtistContribs resolves empty`);
+
+  track.coverArtistContribs = contribs;
   track.disableUniqueCoverArt = true;
 
   t.equal(track.coverArtDate, null,
-    `coverArtDate #6: is null if track disables unique cover artwork`);
+    `coverArtDate #8: is null if track disables unique cover artwork`);
 });
 
 t.test(`Track.coverArtFileExtension`, t => {