From 0fc9972296f19c5da546861b9f3bb6d08c007d20 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 6 Dec 2022 17:02:50 -0400 Subject: quick-reload HSMusic-dedicated data tests --- test/data-tests/test-no-short-tracks.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/data-tests/test-no-short-tracks.js (limited to 'test/data-tests/test-no-short-tracks.js') 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; +} -- cgit 1.3.0-6-gf8a5