diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-12-06 17:02:50 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-12-06 17:02:50 -0400 |
commit | 0fc9972296f19c5da546861b9f3bb6d08c007d20 (patch) | |
tree | 808ca28e45896fa4b06f355f7b5ef11fdbffdb17 /test/data-tests/test-no-short-tracks.js | |
parent | 04acee7dfdaf81f8c548cd8ed1031cd01b1396b4 (diff) |
quick-reload HSMusic-dedicated data tests
Diffstat (limited to 'test/data-tests/test-no-short-tracks.js')
-rw-r--r-- | test/data-tests/test-no-short-tracks.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/data-tests/test-no-short-tracks.js b/test/data-tests/test-no-short-tracks.js new file mode 100644 index 00000000..76356099 --- /dev/null +++ b/test/data-tests/test-no-short-tracks.js @@ -0,0 +1,25 @@ +export default function({ + albumData, + getTotalDuration, +}) { + const shortAlbums = albumData + .filter(album => album.tracks.length > 1) + .map(album => ({ + album, + duration: getTotalDuration(album.tracks), + })) + .filter(album => album.duration) + .filter(album => album.duration < 60 * 15); + + if (!shortAlbums.length) return true; + + shortAlbums.sort((a, b) => a.duration - b.duration); + + console.log(`Found ${shortAlbums.length} short albums! Oh nooooooo!`); + console.log(`Here are the shortest 10:`); + for (const {duration, album} of shortAlbums.slice(0, 10)) { + console.log(`- (${duration}s)`, album); + } + + return false; +} |