From d7b81934b148b99c6dd0f81c8bccef791b259e68 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:58:04 +1100 Subject: [PATCH] Remove unused authAjax function --- src/components/__tests__/jellyfinApi.test.ts | 31 -------------------- src/components/jellyfinApi.ts | 23 --------------- 2 files changed, 54 deletions(-) diff --git a/src/components/__tests__/jellyfinApi.test.ts b/src/components/__tests__/jellyfinApi.test.ts index e1390249..83277877 100644 --- a/src/components/__tests__/jellyfinApi.test.ts +++ b/src/components/__tests__/jellyfinApi.test.ts @@ -142,37 +142,6 @@ describe('creating image urls', () => { }); }); -describe('test authenticated ajax', () => { - beforeAll(() => { - setupMockCastSenders(); - }); - - test('should return rejected promise when server info is undefined', async () => { - // Linting requires this weird spacing. - JellyfinApi.setServerInfo(undefined, '', ''); - - const resultUserIdIsNull = JellyfinApi.authAjax('', {}); - - JellyfinApi.setServerInfo('', undefined, ''); - - const resultAccessTokenIsNull = JellyfinApi.authAjax('', {}); - - JellyfinApi.setServerInfo('', '', undefined); - - const resultServerAddressIsNull = JellyfinApi.authAjax('', {}); - - await expect(resultUserIdIsNull).rejects.toEqual( - 'no server info present' - ); - await expect(resultAccessTokenIsNull).rejects.toEqual( - 'no server info present' - ); - await expect(resultServerAddressIsNull).rejects.toEqual( - 'no server info present' - ); - }); -}); - describe('test authenticated user ajax', () => { test('should return rejected promise when server info is undefined', async () => { // Linting requires this weird spacing. diff --git a/src/components/jellyfinApi.ts b/src/components/jellyfinApi.ts index 12f86df8..52fb40f9 100644 --- a/src/components/jellyfinApi.ts +++ b/src/components/jellyfinApi.ts @@ -192,29 +192,6 @@ export abstract class JellyfinApi { ); } - // Authenticated ajax - // eslint-disable-next-line @typescript-eslint/no-explicit-any - public static authAjax(path: string, args: any): Promise { - if ( - this.userId === undefined || - this.accessToken === undefined || - this.serverAddress === undefined - ) { - console.error( - 'JellyfinApi.authAjax: No userid/accesstoken/serverAddress present. Skipping request' - ); - - return Promise.reject('no server info present'); - } - - const params = { - headers: this.getSecurityHeaders(), - url: this.createUrl(path) - }; - - return ajax({ ...params, ...args }); - } - // Authenticated ajax // eslint-disable-next-line @typescript-eslint/no-explicit-any public static authAjaxUser(path: string, args: any): Promise {