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 /src/hypixelCached.ts | |
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 'src/hypixelCached.ts')
-rw-r--r-- | src/hypixelCached.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts index 3dc89a3..aa3100b 100644 --- a/src/hypixelCached.ts +++ b/src/hypixelCached.ts @@ -12,49 +12,50 @@ import { debug } from '.' // cache usernames for 4 hours /** uuid: username */ -const usernameCache = new NodeCache({ +export const usernameCache = new NodeCache({ stdTTL: 60 * 60 * 4, checkperiod: 60, useClones: false, }) -const basicProfilesCache = new NodeCache({ +export const basicProfilesCache = new NodeCache({ stdTTL: 60 * 10, checkperiod: 60, useClones: true, }) -const playerCache = new NodeCache({ +export const playerCache = new NodeCache({ stdTTL: 60, checkperiod: 10, useClones: true, }) // cache "basic players" (players without profiles) for 4 hours -const basicPlayerCache = new NodeCache({ +export const basicPlayerCache = new NodeCache({ stdTTL: 60 * 60 * 4, checkperiod: 60 * 10, useClones: true }) -const profileCache = new NodeCache({ +export const profileCache = new NodeCache({ stdTTL: 30, checkperiod: 10, useClones: true, }) -const profilesCache = new NodeCache({ +export const profilesCache = new NodeCache({ stdTTL: 60 * 3, checkperiod: 10, useClones: false, }) -const profileNameCache = new NodeCache({ +export const profileNameCache = new NodeCache({ stdTTL: 60 * 60, checkperiod: 60, useClones: false, }) + interface KeyValue { key: any value: any |