« get me outta code hell

test: update track section unit tests, don't be magically easy - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/data/things/track.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-01 00:03:22 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-01 00:03:52 -0300
commit401236648e1efe907798dd4e2d368f1fbc773b62 (patch)
treea753a0efc80c193ba117b9ccebe282fdb214d6dc /test/unit/data/things/track.js
parenta9384aaa1d5951dda497749776c872b3aa2a83d1 (diff)
test: update track section unit tests, don't be magically easy
Most notably drops automatically setting ownTrackData.
Hilariously, this doesn't break any tests (presumably because
they were generally updated to handle a newer - albeit not the
newest - track section format).
Diffstat (limited to 'test/unit/data/things/track.js')
-rw-r--r--test/unit/data/things/track.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js
index 644d21ce..c6695b6f 100644
--- a/test/unit/data/things/track.js
+++ b/test/unit/data/things/track.js
@@ -19,7 +19,8 @@ function stubAlbum(tracks, directory = 'bar') {
   album.directory = directory;
 
   const trackSection = stubTrackSection(album, tracks);
-  album.trackSections = [trackSection];
+  album.trackSections = [`unqualified-track-section:${trackSection.unqualifiedDirectory}`];
+  album.ownTrackSectionData = [trackSection];
 
   return album;
 }
@@ -93,6 +94,10 @@ t.test(`Track.album`, t => {
   const album2 = new Album();
   const section1 = new TrackSection();
   const section2 = new TrackSection();
+  section1.unqualifiedDirectory = 'section1';
+  section2.unqualifiedDirectory = 'section2';
+  const section1_ref = `unqualified-track-section:section1`;
+  const section2_ref = `unqualified-track-section:section2`;
 
   t.equal(track1.album, null,
     `album #1: defaults to null`);
@@ -105,8 +110,10 @@ t.test(`Track.album`, t => {
   section2.ownAlbumData = [album2];
   section1.tracks = ['track:track1'];
   section2.tracks = ['track:track2'];
-  album1.trackSections = [section1];
-  album2.trackSections = [section2];
+  album1.trackSections = [section1_ref];
+  album2.trackSections = [section2_ref];
+  album1.ownTrackSectionData = [section1];
+  album2.ownTrackSectionData = [section2];
 
   t.equal(track1.album, album1,
     `album #2: is album when album's trackSections matches track`);
@@ -125,7 +132,7 @@ t.test(`Track.album`, t => {
 
   // XXX_decacheWikiData
   album1.trackSections = [];
-  album1.trackSections = [section1];
+  album1.trackSections = [section1_ref];
   track1.albumData = [];
   track1.albumData = [album2, album1];
 
@@ -137,7 +144,7 @@ t.test(`Track.album`, t => {
 
   // XXX_decacheWikiData
   album1.trackSections = [];
-  album1.trackSections = [section1];
+  album1.trackSections = [section1_ref];
   track1.albumData = [];
   track1.albumData = [album2, album1];
 
@@ -308,12 +315,13 @@ t.test(`Track.color`, t => {
   t.equal(track.color, null,
     `color #1: defaults to null`);
 
-  const section = stubTrackSection(album, [track]);
+  const section = stubTrackSection(album, [track], 'section');
 
   album.color = '#abcdef';
   section.color = '#beeeef';
 
-  album.trackSections = [section];
+  album.trackSections = [`unqualified-track-section:section`];
+  album.ownTrackSectionData = [section];
 
   XXX_decacheWikiData();