From 4ce80d0af8f53e93aa3a936b1ad4c5b6c065c881 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Tue, 27 Apr 2021 14:29:07 -0500 Subject: 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 --- build/database.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'build/database.js') 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); + }); +} -- cgit