Skip to content

Commit 0fffedd

Browse files
CCM-13135: fix build failures
1 parent 4ad55c8 commit 0fffedd

File tree

6 files changed

+8
-62
lines changed

6 files changed

+8
-62
lines changed

utils/client-management/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"aws-sdk-client-mock-jest": "^4.1.0",
1414
"jest": "^29.7.0",
1515
"jest-mock-extended": "^3.0.7",
16-
"typescript": "^5.8.2"
16+
"typescript": "^5.9.3"
1717
},
1818
"main": "src/index.ts",
1919
"name": "client-management",
Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,22 @@
11
import { mockDeep } from 'jest-mock-extended';
2-
import { ClientMetadata } from 'utils';
32
import { AppDependencies, createApp } from '../../app';
43
import { DeleteClientCommandParameters } from '../../app/delete-client';
54

65
function setup() {
7-
const clientId = 'input_id';
8-
9-
const metadata: ClientMetadata[] = [
10-
{
11-
clientId,
12-
provider: 'govuknotify',
13-
scope: 'client-metadata',
14-
type: 'api_key',
15-
value: 'test_secret',
16-
},
17-
{
18-
clientId,
19-
provider: 'govuknotify',
20-
scope: 'client-metadata',
21-
type: 'polling_index',
22-
value: 'notifyid',
23-
},
24-
];
25-
266
const mocks = mockDeep<AppDependencies>({
277
infra: {
288
clientRepository: {
299
deleteClient: jest.fn(),
3010
},
31-
metadataRepository: {
32-
listMetadata: jest.fn().mockResolvedValueOnce(metadata),
33-
},
3411
},
3512
});
3613

37-
return { mocks, data: { metadata } };
14+
return mocks;
3815
}
3916

4017
describe('deleteClient', () => {
4118
it('deletes the client from the client repository by id', async () => {
42-
const { mocks } = setup();
19+
const mocks = setup();
4320

4421
const app = createApp(mocks);
4522

@@ -53,7 +30,7 @@ describe('deleteClient', () => {
5330
});
5431

5532
it('optionally also deletes associated client metadata', async () => {
56-
const { data, mocks } = setup();
33+
const mocks = setup();
5734

5835
const app = createApp(mocks);
5936

@@ -67,21 +44,5 @@ describe('deleteClient', () => {
6744
expect(mocks.infra.clientRepository.deleteClient).toHaveBeenCalledWith(
6845
input.clientId,
6946
);
70-
71-
expect(mocks.infra.metadataRepository.listMetadata).toHaveBeenCalledWith(
72-
input.clientId,
73-
);
74-
75-
expect(mocks.infra.metadataRepository.deleteMetadata).toHaveBeenCalledTimes(
76-
2,
77-
);
78-
79-
expect(mocks.infra.metadataRepository.deleteMetadata).toHaveBeenCalledWith(
80-
data.metadata[0],
81-
);
82-
83-
expect(mocks.infra.metadataRepository.deleteMetadata).toHaveBeenCalledWith(
84-
data.metadata[1],
85-
);
8647
});
8748
});

utils/client-management/src/app/delete-client.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ export function createDeleteClientCommand({ infra }: AppDependencies) {
99
return async function deleteClientCommand(
1010
params: DeleteClientCommandParameters,
1111
): Promise<void> {
12-
if (params.deleteMetadata) {
13-
const metadataItems = await infra.metadataRepository.listMetadata(
14-
params.clientId,
15-
);
16-
17-
await Promise.all(
18-
metadataItems.map(async (item) =>
19-
infra.metadataRepository.deleteMetadata(item),
20-
),
21-
);
22-
}
23-
2412
await infra.clientRepository.deleteClient(params.clientId);
2513
};
2614
}

utils/client-management/src/app/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export function createApp(dependencies: AppDependencies) {
1414
}
1515

1616
export type App = ReturnType<typeof createApp>;
17+
export * from './types';

utils/client-management/src/infra/client-repository/repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IClientRepository } from '../interfaces';
77
export type Dependencies = {
88
config: Config;
99
parameterStore: IParameterStore;
10-
logger?: Logger;
10+
logger: Logger;
1111
};
1212

1313
export class ClientRepository implements IClientRepository {

utils/client-management/src/infra/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ export type Infrastructure = {
1313
clientRepository: IClientRepository;
1414
};
1515

16-
export function createInfra({
17-
config,
18-
logger: _logger,
19-
parameterStore,
20-
}: Dependencies): Infrastructure {
21-
const clientRepository = new ClientRepository({ config, parameterStore });
16+
export function createInfra(dependencies: Dependencies): Infrastructure {
17+
const clientRepository = new ClientRepository(dependencies);
2218

2319
return {
2420
clientRepository,

0 commit comments

Comments
 (0)