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 --- src/hypixelCached.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/hypixelCached.ts') 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 -- cgit