« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/data/things/album.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/data/things/album.js')
-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 5a1261a..46ea83b 100644
--- a/test/unit/data/things/album.js
+++ b/test/unit/data/things/album.js
@@ -5,10 +5,18 @@ import thingConstructors from '#things';
 
 const {
   Album,
+  ArtTag,
   Artist,
   Track,
 } = thingConstructors;
 
+function stubArtTag(tagName = `Test Art Tag`) {
+  const tag = new ArtTag();
+  tag.name = tagName;
+
+  return tag;
+}
+
 function stubArtistAndContribs() {
   const artist = new Artist();
   artist.name = `Test Artist`;
@@ -26,6 +34,34 @@ function stubTrack(directory = 'foo') {
   return track;
 }
 
+t.test(`Album.artTags`, t => {
+  t.plan(3);
+
+  const {artist, contribs} = stubArtistAndContribs();
+  const album = new Album();
+  const tag1 = stubArtTag(`Tag 1`);
+  const tag2 = stubArtTag(`Tag 2`);
+
+  const {XXX_decacheWikiData} = linkAndBindWikiData({
+    albumData: [album],
+    artistData: [artist],
+    artTagData: [tag1, tag2],
+  });
+
+  t.same(album.artTags, [],
+    `artTags #1: defaults to empty array`);
+
+  album.artTags = [`Tag 1`, `Tag 2`];
+
+  t.same(album.artTags, [],
+    `artTags #2: is empty if album doesn't have cover artists`);
+
+  album.coverArtistContribs = contribs;
+
+  t.same(album.artTags, [tag1, tag2],
+    `artTags #3: resolves if album has cover artists`);
+});
+
 t.test(`Album.bannerDimensions`, t => {
   t.plan(4);