Skip to content

Commit 81b2a8a

Browse files
committed
CCM-12875: remove unused function
1 parent 62e256c commit 81b2a8a

File tree

3 files changed

+1
-61
lines changed

3 files changed

+1
-61
lines changed

lambdas/pdm-uploader-lambda/src/__tests__/infra/pdm-api-client.test.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -197,43 +197,4 @@ describe('PdmClient', () => {
197197
});
198198
});
199199
});
200-
201-
describe('isAccessible', () => {
202-
it('should return true when service is accessible', async () => {
203-
mockAxiosInstance.head.mockResolvedValue({});
204-
205-
const result = await pdmClient.isAccessible();
206-
207-
expect(mockAccessTokenRepository.getAccessToken).toHaveBeenCalled();
208-
expect(mockAxiosInstance.head).toHaveBeenCalledWith('/', {
209-
headers: { Authorization: 'Bearer mock-access-token' },
210-
});
211-
expect(result).toBe(true);
212-
});
213-
214-
it('should return false and log error when service is not accessible', async () => {
215-
const mockError = new Error('Connection failed');
216-
mockAxiosInstance.head.mockRejectedValue(mockError);
217-
218-
const result = await pdmClient.isAccessible();
219-
220-
expect(result).toBe(false);
221-
expect(mockLogger.error).toHaveBeenCalledWith({
222-
description: 'NHS API Unavailable',
223-
err: mockError,
224-
});
225-
});
226-
227-
it('should handle empty access token in accessibility check', async () => {
228-
mockAccessTokenRepository.getAccessToken.mockResolvedValue('');
229-
mockAxiosInstance.head.mockResolvedValue({});
230-
231-
const result = await pdmClient.isAccessible();
232-
233-
expect(mockAxiosInstance.head).toHaveBeenCalledWith('/', {
234-
headers: { Authorization: 'Bearer ' },
235-
});
236-
expect(result).toBe(true);
237-
});
238-
});
239200
});

lambdas/pdm-uploader-lambda/src/infra/pdm-api-client.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import axios, { AxiosInstance, isAxiosError } from 'axios';
22
import { constants as HTTP2_CONSTANTS } from 'node:http2';
33
import {
4-
IAccessibleService,
54
Logger,
65
PdmResponse,
76
RetryConfig,
@@ -20,7 +19,7 @@ export interface IPdmClient {
2019
): Promise<PdmResponse>;
2120
}
2221

23-
export class PdmClient implements IPdmClient, IAccessibleService {
22+
export class PdmClient implements IPdmClient {
2423
private client: AxiosInstance;
2524

2625
constructor(
@@ -93,20 +92,4 @@ export class PdmClient implements IPdmClient, IAccessibleService {
9392
throw error;
9493
}
9594
}
96-
97-
public async isAccessible(): Promise<boolean> {
98-
try {
99-
const accessToken = await this.accessTokenRepository.getAccessToken();
100-
await this.client.head('/', {
101-
headers: { Authorization: `Bearer ${accessToken}` },
102-
});
103-
return true;
104-
} catch (error: any) {
105-
this.logger.error({
106-
description: 'NHS API Unavailable',
107-
err: error,
108-
});
109-
return false;
110-
}
111-
}
11295
}

utils/utils/src/ssm-utils/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ export interface IParameterStore {
3030

3131
export type NonNullSSMParam = Omit<Parameter, 'Name' | 'Value'> &
3232
Required<Pick<Parameter, 'Name' | 'Value'>>;
33-
34-
export interface IAccessibleService {
35-
isAccessible(): Promise<boolean>;
36-
}

0 commit comments

Comments
 (0)