« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-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'}));
+        }
       }
     }
   }