« get me outta code hell

data, test: expose track section names - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-01 17:58:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-01 17:58:56 -0300
commita60c8906ed7580a21527c9f96cd0e6e277978263 (patch)
tree71c862e8c366294697afc6b980a8af5591c8e39c /test/unit
parentd2174a01dda63ba233cbcdf48bb70ed50127d54d (diff)
data, test: expose track section names
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/data/things/album.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/unit/data/things/album.js b/test/unit/data/things/album.js
index c5f7fa98..76a2b90f 100644
--- a/test/unit/data/things/album.js
+++ b/test/unit/data/things/album.js
@@ -252,7 +252,7 @@ t.test(`Album.tracks`, t => {
 });
 
 t.test(`Album.trackSections`, t => {
-  t.plan(6);
+  t.plan(7);
 
   const album = new Album();
   const track1 = stubTrack('track1');
@@ -280,6 +280,18 @@ t.test(`Album.trackSections`, t => {
     {tracks: [track3, track4], startIndex: 2},
   ], `Album.trackSections #2: exposes startIndex`);
 
+  album.trackSections = [
+    {name: 'First section', tracks: ['track:track1']},
+    {name: 'Second section', tracks: ['track:track2']},
+    {tracks: ['track:track3']},
+  ];
+
+  t.match(album.trackSections, [
+    {name: 'First section', tracks: [track1]},
+    {name: 'Second section', tracks: [track2]},
+    {name: 'Unnamed Track Section', tracks: [track3]},
+  ], `Album.trackSections #3: exposes name, with fallback value`);
+
   album.color = '#123456';
 
   album.trackSections = [
@@ -292,7 +304,7 @@ t.test(`Album.trackSections`, t => {
     {tracks: [track1], color: '#123456'},
     {tracks: [track2], color: '#abcdef'},
     {tracks: [track3], color: '#123456'},
-  ], `Album.trackSections #3: exposes color, inherited from album`);
+  ], `Album.trackSections #4: exposes color, inherited from album`);
 
   album.trackSections = [
     {tracks: ['track:track1'], dateOriginallyReleased: null},
@@ -304,7 +316,7 @@ t.test(`Album.trackSections`, t => {
     {tracks: [track1], dateOriginallyReleased: null},
     {tracks: [track2], dateOriginallyReleased: new Date('2009-04-11')},
     {tracks: [track3], dateOriginallyReleased: null},
-  ], `Album.trackSections #4: exposes dateOriginallyReleased, if present`);
+  ], `Album.trackSections #5: exposes dateOriginallyReleased, if present`);
 
   album.trackSections = [
     {tracks: ['track:track1'], isDefaultTrackSection: true},
@@ -316,7 +328,7 @@ t.test(`Album.trackSections`, t => {
     {tracks: [track1], isDefaultTrackSection: true},
     {tracks: [track2], isDefaultTrackSection: false},
     {tracks: [track3], isDefaultTrackSection: false},
-  ], `Album.trackSections #5: exposes isDefaultTrackSection, defaults to false`);
+  ], `Album.trackSections #6: exposes isDefaultTrackSection, defaults to false`);
 
   album.trackSections = [
     {tracks: ['track:track1', 'track:track2', 'track:snooping'], color: '#112233'},
@@ -330,7 +342,7 @@ t.test(`Album.trackSections`, t => {
     {tracks: [track1, track2], color: '#112233'},
     {tracks: [track3],         color: '#334455'},
     {tracks: [track4],         color: '#778899'},
-  ], `Album.trackSections #6: filters out references without matches & empty sections`);
+  ], `Album.trackSections #7: filters out references without matches & empty sections`);
 });
 
 t.test(`Album.wallpaperFileExtension`, t => {