diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-08-05 12:19:58 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-08-05 20:42:08 -0300 |
commit | 0dc4db58b90f46cc938b72d571d690e197c6c243 (patch) | |
tree | 132d1f2fb76fa32cd60c26591ae92a3877c9bdd4 /test | |
parent | bf2fcfa1f8e3791951ccee2a669e94fa27199e45 (diff) |
data, test: Album.trackSections: use direct links
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/data/things/album.js | 34 | ||||
-rw-r--r-- | test/unit/data/things/track.js | 18 |
2 files changed, 16 insertions, 36 deletions
diff --git a/test/unit/data/things/album.js b/test/unit/data/things/album.js index 06265b09..e9c0d700 100644 --- a/test/unit/data/things/album.js +++ b/test/unit/data/things/album.js @@ -262,13 +262,6 @@ t.test(`Album.tracks`, t => { const section6 = stubTrackSection(album, [], 'section6'); const sections = [section1, section2, section3, section4, section5, section6]; - const section1_ref = `unqualified-track-section:section1`; - const section2_ref = `unqualified-track-section:section2`; - const section3_ref = `unqualified-track-section:section3`; - const section4_ref = `unqualified-track-section:section4`; - const section5_ref = `unqualified-track-section:section5`; - const section6_ref = `unqualified-track-section:section6`; - for (const track of tracks) { track.albumData = [album]; } @@ -283,8 +276,7 @@ t.test(`Album.tracks`, t => { section1.tracks = ['track:track1', 'track:track2', 'track:track3']; section1.ownTrackData = [track1, track2, track3]; - album.trackSections = [section1_ref]; - album.ownTrackSectionData = [section1]; + album.trackSections = [section1]; t.same(album.tracks, [track1, track2, track3], `Album.tracks #2: pulls tracks from one track section`); @@ -295,8 +287,7 @@ t.test(`Album.tracks`, t => { section1.ownTrackData = [track1]; section2.ownTrackData = [track2, track3]; - album.trackSections = [section1_ref, section2_ref]; - album.ownTrackSectionData = [section1, section2]; + album.trackSections = [section1, section2]; t.same(album.tracks, [track1, track2, track3], `Album.tracks #3: pulls tracks from multiple track sections`); @@ -311,8 +302,7 @@ t.test(`Album.tracks`, t => { section3.ownTrackData = []; section4.ownTrackData = [track3]; - album.trackSections = [section1_ref, section2_ref, section3_ref, section4_ref]; - album.ownTrackSectionData = [section1, section2, section3, section4]; + album.trackSections = [section1, section2, section3, section4]; t.same(album.tracks, [track1, track2, track3], `Album.tracks #4: filters out references without matches`); @@ -331,8 +321,7 @@ t.test(`Album.tracks`, t => { section5.ownTrackData = []; section6.ownTrackData = [track3]; - album.trackSections = [section1_ref, section2_ref, section3_ref, section4_ref, section5_ref, section6_ref]; - album.ownTrackSectionData = [section1, section2, section3, section4, section5, section6]; + album.trackSections = [section1, section2, section3, section4, section5, section6]; t.same(album.tracks, [track1, track2, track3], `Album.tracks #5: skips empty track sections`); @@ -372,8 +361,7 @@ t.test(`Album.trackSections`, t => { section1.ownTrackData = [track1, track2]; section2.ownTrackData = [track3, track4]; - album.trackSections = [section1_ref, section2_ref]; - album.ownTrackSectionData = [section1, section2]; + album.trackSections = [section1, section2]; t.match(album.trackSections, [ {tracks: [track1, track2]}, @@ -396,8 +384,7 @@ t.test(`Album.trackSections`, t => { section1.name = 'First section'; section2.name = 'Second section'; - album.trackSections = [section1_ref, section2_ref, section3_ref]; - album.ownTrackSectionData = [section1, section2, section3]; + album.trackSections = [section1, section2, section3]; t.match(album.trackSections, [ {name: 'First section', tracks: [track1]}, @@ -411,7 +398,7 @@ t.test(`Album.trackSections`, t => { // XXX_decacheWikiData album.trackSections = []; - album.trackSections = [section1_ref, section2_ref, section3_ref]; + album.trackSections = [section1, section2, section3]; t.match(album.trackSections, [ {tracks: [track1], color: '#123456'}, @@ -423,7 +410,7 @@ t.test(`Album.trackSections`, t => { // XXX_decacheWikiData album.trackSections = []; - album.trackSections = [section1_ref, section2_ref, section3_ref]; + album.trackSections = [section1, section2, section3]; t.match(album.trackSections, [ {tracks: [track1], dateOriginallyReleased: null}, @@ -436,7 +423,7 @@ t.test(`Album.trackSections`, t => { // XXX_decacheWikiData album.trackSections = []; - album.trackSections = [section1_ref, section2_ref, section3_ref]; + album.trackSections = [section1, section2, section3]; t.match(album.trackSections, [ {tracks: [track1], isDefaultTrackSection: true}, @@ -462,8 +449,7 @@ t.test(`Album.trackSections`, t => { section4.color = '#556677'; section5.color = '#778899'; - album.trackSections = [section1_ref, section2_ref, section3_ref, section4_ref, section5_ref]; - album.ownTrackSectionData = [section1, section2, section3, section4, section5]; + album.trackSections = [section1, section2, section3, section4, section5]; t.match(album.trackSections, [ {tracks: [track1, track2], color: '#112233'}, diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js index 74231e20..e27fb449 100644 --- a/test/unit/data/things/track.js +++ b/test/unit/data/things/track.js @@ -19,8 +19,7 @@ function stubAlbum(tracks, directory = 'bar') { album.directory = directory; const trackSection = stubTrackSection(album, tracks); - album.trackSections = [`unqualified-track-section:${trackSection.unqualifiedDirectory}`]; - album.ownTrackSectionData = [trackSection]; + album.trackSections = [trackSection]; return album; } @@ -96,8 +95,6 @@ t.test(`Track.album`, t => { 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`); @@ -110,10 +107,8 @@ t.test(`Track.album`, t => { section2.ownAlbumData = [album2]; section1.tracks = ['track:track1']; section2.tracks = ['track:track2']; - album1.trackSections = [section1_ref]; - album2.trackSections = [section2_ref]; - album1.ownTrackSectionData = [section1]; - album2.ownTrackSectionData = [section2]; + album1.trackSections = [section1]; + album2.trackSections = [section2]; t.equal(track1.album, album1, `album #2: is album when album's trackSections matches track`); @@ -132,7 +127,7 @@ t.test(`Track.album`, t => { // XXX_decacheWikiData album1.trackSections = []; - album1.trackSections = [section1_ref]; + album1.trackSections = [section1]; track1.albumData = []; track1.albumData = [album2, album1]; @@ -144,7 +139,7 @@ t.test(`Track.album`, t => { // XXX_decacheWikiData album1.trackSections = []; - album1.trackSections = [section1_ref]; + album1.trackSections = [section1]; track1.albumData = []; track1.albumData = [album2, album1]; @@ -320,8 +315,7 @@ t.test(`Track.color`, t => { album.color = '#abcdef'; section.color = '#beeeef'; - album.trackSections = [`unqualified-track-section:section`]; - album.ownTrackSectionData = [section]; + album.trackSections = [section]; XXX_decacheWikiData(); |