« get me outta code hell

data: TrackSection thing objects - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/lib
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-19 21:44:18 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-19 21:47:31 -0300
commit048e79a1ea83a942579ce89f797795e34cc4199e (patch)
treec810109a93bc5fe1dbae611bb6efb212846df00f /test/lib
parent471de6e5ac73bd6c769a58392e3e49aff6d8f2cb (diff)
data: TrackSection thing objects
Sorry this commit is kind of monolithic! It's difficult to
separate out any of the changes since they're all related to
track sections' basic functionality.
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/wiki-data.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/lib/wiki-data.js b/test/lib/wiki-data.js
index d2d860ce..75b1170a 100644
--- a/test/lib/wiki-data.js
+++ b/test/lib/wiki-data.js
@@ -13,20 +13,20 @@ export function linkAndBindWikiData(wikiData, {
             .map(([key, value]) => [key, value.slice()]))
         : wikiData));
 
-    // If albumData is present, automatically set albums' ownTrackData values
-    // by resolving track sections' references against the full array. This is
-    // just a nicety for working with albums throughout tests.
+    // If albumData is present, automatically set their sections' ownTrackData
+    // by resolving references against the full array. This is just a nicety
+    // for working with albums throughout tests.
     if (inferAlbumsOwnTrackData && wikiData.albumData && wikiData.trackData) {
       for (const album of wikiData.albumData) {
         const trackSections =
           CacheableObject.getUpdateValue(album, 'trackSections');
 
-        const trackRefs =
-          trackSections.flatMap(section => section.tracks);
-
-        album.ownTrackData =
-          trackRefs.map(ref =>
-            find.track(ref, wikiData.trackData, {mode: 'error'}));
+        for (const trackSection of trackSections) {
+          trackSection.ownTrackData =
+            CacheableObject.getUpdateValue(trackSection, 'tracks')
+              .map(ref =>
+                find.track(ref, wikiData.trackData, {mode: 'error'}));
+        }
       }
     }
   }