diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-27 14:29:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 14:29:07 -0500 |
commit | 4ce80d0af8f53e93aa3a936b1ad4c5b6c065c881 (patch) | |
tree | f5ffb4d7a23d7c6edee01fb605ff81348feea40d /build/database.js | |
parent | 562cd341f75bfb2701cc844cf30f1191e4170ca7 (diff) | |
download | skyblock-api-4ce80d0af8f53e93aa3a936b1ad4c5b6c065c881.tar.gz skyblock-api-4ce80d0af8f53e93aa3a936b1ad4c5b6c065c881.tar.bz2 skyblock-api-4ce80d0af8f53e93aa3a936b1ad4c5b6c065c881.zip |
Add unit tests (#12)
* start adding unit tests
* add more to test/data/mojang.json
* fix sending http requests in tests when it shouldn't
* add a few more tests
* try to add a github action to run tests
* Update test.yml
Diffstat (limited to 'build/database.js')
-rw-r--r-- | build/database.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/build/database.js b/build/database.js index 8a29686..be193e9 100644 --- a/build/database.js +++ b/build/database.js @@ -358,11 +358,14 @@ async function fetchAllLeaderboards(fast) { if (_1.debug) console.log('Finished caching leaderboards!'); } -connect().then(() => { - // when it connects, cache the leaderboards and remove bad members - removeBadMemberLeaderboardAttributes(); - // cache leaderboards on startup so its faster later on - fetchAllLeaderboards(true); - // cache leaderboard players again every 4 hours - setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000); -}); +// make sure it's not in a test +if (typeof global.it !== 'function') { + connect().then(() => { + // when it connects, cache the leaderboards and remove bad members + removeBadMemberLeaderboardAttributes(); + // cache leaderboards on startup so its faster later on + fetchAllLeaderboards(true); + // cache leaderboard players again every 4 hours + setInterval(fetchAllLeaderboards, 4 * 60 * 60 * 1000); + }); +} |