diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-03-25 14:19:23 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-03-25 14:19:23 -0300 |
commit | fad524ed133af6f094357b94da54e616c7f943b6 (patch) | |
tree | 89482c00ea3ffdd0ed2ca7625887c9f077f7a560 /data-tests/test-no-short-tracks.js | |
parent | 8ab00d99fa2f14ac983f0693552b26e4050a939c (diff) |
data steps: move data-tests outside tests
These are mostly short REPL-like scripts for testing actual wiki data, not the codebase. They don't really belong in the repo at all, but actually cause trouble by living in the main tests directory!
Diffstat (limited to 'data-tests/test-no-short-tracks.js')
-rw-r--r-- | data-tests/test-no-short-tracks.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/data-tests/test-no-short-tracks.js b/data-tests/test-no-short-tracks.js new file mode 100644 index 0000000..7635609 --- /dev/null +++ b/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; +} |