From adc1a7af012744e5b837d07ed1919776b821cdc1 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 28 Mar 2022 17:45:35 +0000 Subject: update tests --- src/hypixel.ts | 4 ++-- src/hypixelApi.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/hypixel.ts b/src/hypixel.ts index 80c73b1..c72e397 100644 --- a/src/hypixel.ts +++ b/src/hypixel.ts @@ -64,13 +64,13 @@ const cleanResponseFunctions = { async function cleanResponse

( path: P, - data: typedHypixelApi.Requests[P]['response'], + data: typedHypixelApi.Requests[P]['response']['data'], options: ApiOptions ): Promise>> { // Cleans up an api response const cleaningFunction: typeof cleanResponseFunctions[P] = cleanResponseFunctions[path] // we do `as any` because typescript unfortunately doesn't know which path it is - const cleanedData = await cleaningFunction(data.data as any, options) + const cleanedData = await cleaningFunction(data as any, options) return cleanedData as Awaited> } diff --git a/src/hypixelApi.ts b/src/hypixelApi.ts index adc6378..5f2bfb1 100644 --- a/src/hypixelApi.ts +++ b/src/hypixelApi.ts @@ -98,7 +98,7 @@ export interface HypixelPlayerSocialMedia { /** Send an HTTP request to the Hypixel API */ -export let sendApiRequest = async

(path: P, options: typedHypixelApi.Requests[P]['options']): Promise => { +export let sendApiRequest = async

(path: P, options: typedHypixelApi.Requests[P]['options']): Promise => { // Send a raw http request to api.hypixel.net, and return the parsed json let response: typedHypixelApi.Requests[P]['response'] try { @@ -152,7 +152,7 @@ export let sendApiRequest = async

(path await sleep(10000) return await sendApiRequest(path, options) } - return response + return response.data } // this is necessary for mocking in the tests because es6 -- cgit