diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-08 13:28:22 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-08 13:31:10 -0300 |
commit | 76ebfecb51b51585bc12164ad2a0bb2a8223392b (patch) | |
tree | 2f93d63b494fa8ead4162919a29dd5bb969933bf /test | |
parent | d814792891485af3423cd2232e20b12a6f051034 (diff) |
test: Track.alwaysReferenceByDirectory (unit)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/data/things/track.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js index e8e2c7e6..14d724bf 100644 --- a/test/unit/data/things/track.js +++ b/test/unit/data/things/track.js @@ -122,6 +122,61 @@ t.test(`Track.album`, t => { `album #6: is null when album's trackSections don't match track`); }); +t.test(`Track.alwaysReferenceByDirectory`, t => { + t.plan(7); + + const {track: originalTrack, album: originalAlbum} = + stubTrackAndAlbum('original-track', 'original-album'); + + const {track: rereleaseTrack, album: rereleaseAlbum} = + stubTrackAndAlbum('rerelease-track', 'rerelease-album'); + + originalTrack.name = 'Cowabunga'; + rereleaseTrack.name = 'Cowabunga'; + + originalTrack.dataSourceAlbum = 'album:original-album'; + rereleaseTrack.dataSourceAlbum = 'album:rerelease-album'; + + rereleaseTrack.originalReleaseTrack = 'track:original-track'; + + const {XXX_decacheWikiData} = linkAndBindWikiData({ + albumData: [originalAlbum, rereleaseAlbum], + trackData: [originalTrack, rereleaseTrack], + }); + + t.equal(originalTrack.alwaysReferenceByDirectory, false, + `alwaysReferenceByDirectory #1: defaults to false`); + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, true, + `alwaysReferenceByDirectory #2: is true if rerelease name matches original`); + + rereleaseTrack.name = 'Foo Dog!'; + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, false, + `alwaysReferenceByDirectory #3: is false if rerelease name doesn't match original`); + + rereleaseTrack.name = `COWabunga`; + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, false, + `alwaysReferenceByDirectory #4: is false if rerelease name doesn't match original exactly`); + + rereleaseAlbum.alwaysReferenceTracksByDirectory = true; + XXX_decacheWikiData(); + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, true, + `alwaysReferenceByDirectory #5: is true if album's alwaysReferenceTracksByDirectory is true`); + + rereleaseTrack.alwaysReferenceByDirectory = false; + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, false, + `alwaysReferenceByDirectory #6: doesn't inherit from album if set to false`); + + rereleaseTrack.name = 'Cowabunga'; + + t.equal(rereleaseTrack.alwaysReferenceByDirectory, false, + `alwaysReferenceByDirectory #7: doesn't compare original release name if set to false`); +}); + t.test(`Track.artTags`, t => { t.plan(6); |