Skip to content

Commit 4f04e0f

Browse files
committed
CCM-11492 Rename
1 parent 0f002d8 commit 4f04e0f

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

frontend/src/__tests__/app/choose-templates/page.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ChooseTemplatesPage, {
33
generateMetadata,
44
} from '@app/message-plans/choose-templates/[routingConfigId]/page';
55
import { CreateEditMessagePlan } from '@organisms/CreateEditMessagePlan/CreateEditMessagePlan';
6-
import { getMessagePlan, getMessagePlanTemplates } from '@utils/message-plans';
6+
import { getRoutingConfig, getMessagePlanTemplates } from '@utils/message-plans';
77
import type {
88
RoutingConfig,
99
RoutingConfigStatus,
@@ -23,7 +23,7 @@ jest.mock('next/navigation');
2323
jest.mock('@utils/message-plans');
2424

2525
const redirectMock = jest.mocked(redirect);
26-
const getMessagePlanMock = jest.mocked(getMessagePlan);
26+
const getMessagePlanMock = jest.mocked(getRoutingConfig);
2727
const getMessagePlanTemplatesMock = jest.mocked(getMessagePlanTemplates);
2828

2929
const validRoutingConfigId = 'fbb81055-79b9-4759-ac07-d191ae57be34';

frontend/src/__tests__/utils/message-plans.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
2-
getMessagePlan,
3-
updateMessagePlan,
2+
getRoutingConfig,
3+
updateRoutingConfig,
44
getTemplatesByIds,
55
getMessagePlanTemplates,
66
getRoutingConfigs,
@@ -284,7 +284,7 @@ describe('Message plans actions', () => {
284284
clientId: undefined,
285285
});
286286

287-
await expect(getMessagePlan(validRoutingConfigId)).rejects.toThrow(
287+
await expect(getRoutingConfig(validRoutingConfigId)).rejects.toThrow(
288288
'Failed to get access token'
289289
);
290290

@@ -294,7 +294,7 @@ describe('Message plans actions', () => {
294294
it('should return the routing config on success', async () => {
295295
routingConfigApiMock.get.mockResolvedValueOnce({ data: baseConfig });
296296

297-
const response = await getMessagePlan(validRoutingConfigId);
297+
const response = await getRoutingConfig(validRoutingConfigId);
298298

299299
expect(routingConfigApiMock.get).toHaveBeenCalledWith(
300300
'mock-token',
@@ -310,7 +310,7 @@ describe('Message plans actions', () => {
310310
},
311311
});
312312

313-
const response = await getMessagePlan(notFoundRoutingConfigId);
313+
const response = await getRoutingConfig(notFoundRoutingConfigId);
314314

315315
expect(routingConfigApiMock.get).toHaveBeenCalledWith(
316316
'mock-token',
@@ -332,7 +332,7 @@ describe('Message plans actions', () => {
332332
data: { ...baseConfig, id: invalidRoutingConfigId },
333333
});
334334

335-
const response = await getMessagePlan(invalidRoutingConfigId);
335+
const response = await getRoutingConfig(invalidRoutingConfigId);
336336

337337
expect(routingConfigApiMock.get).toHaveBeenCalledWith(
338338
'mock-token',
@@ -350,7 +350,7 @@ describe('Message plans actions', () => {
350350
{} as Result<RoutingConfig>
351351
);
352352

353-
const response = await getMessagePlan(validRoutingConfigId);
353+
const response = await getRoutingConfig(validRoutingConfigId);
354354

355355
expect(response).toBeUndefined();
356356
});
@@ -364,7 +364,7 @@ describe('Message plans actions', () => {
364364
});
365365

366366
await expect(
367-
updateMessagePlan(validRoutingConfigId, baseConfig)
367+
updateRoutingConfig(validRoutingConfigId, baseConfig)
368368
).rejects.toThrow('Failed to get access token');
369369

370370
expect(routingConfigApiMock.update).not.toHaveBeenCalled();
@@ -379,7 +379,7 @@ describe('Message plans actions', () => {
379379

380380
routingConfigApiMock.update.mockResolvedValueOnce({ data: updated });
381381

382-
const response = await updateMessagePlan(validRoutingConfigId, updated);
382+
const response = await updateRoutingConfig(validRoutingConfigId, updated);
383383

384384
expect(routingConfigApiMock.update).toHaveBeenCalledWith(
385385
'mock-token',
@@ -395,7 +395,7 @@ describe('Message plans actions', () => {
395395
{} as Result<RoutingConfig>
396396
);
397397

398-
const response = await updateMessagePlan(
398+
const response = await updateRoutingConfig(
399399
validRoutingConfigId,
400400
baseConfig
401401
);
@@ -410,7 +410,7 @@ describe('Message plans actions', () => {
410410
},
411411
});
412412

413-
const response = await updateMessagePlan(
413+
const response = await updateRoutingConfig(
414414
validRoutingConfigId,
415415
baseConfig
416416
);
@@ -436,7 +436,7 @@ describe('Message plans actions', () => {
436436
data: { ...baseConfig, id: invalidRoutingConfigId },
437437
});
438438

439-
const response = await updateMessagePlan(
439+
const response = await updateRoutingConfig(
440440
invalidRoutingConfigId,
441441
baseConfig
442442
);

frontend/src/app/message-plans/choose-templates/[routingConfigId]/page.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import { Metadata } from 'next';
44
import { CreateEditMessagePlan } from '@organisms/CreateEditMessagePlan/CreateEditMessagePlan';
55
import { MessagePlanPageProps } from 'nhs-notify-web-template-management-utils';
6-
import { getMessagePlan, getMessagePlanTemplates } from '@utils/message-plans';
6+
import {
7+
getRoutingConfig,
8+
getMessagePlanTemplates,
9+
} from '@utils/message-plans';
710
import { redirect, RedirectType } from 'next/navigation';
811

912
import content from '@content/content';
@@ -18,7 +21,7 @@ export async function generateMetadata(): Promise<Metadata> {
1821
export default async function ChooseTemplatesPage(props: MessagePlanPageProps) {
1922
const { routingConfigId } = await props.params;
2023

21-
const messagePlan = await getMessagePlan(routingConfigId);
24+
const messagePlan = await getRoutingConfig(routingConfigId);
2225

2326
if (!messagePlan) {
2427
return redirect('/message-plans/invalid', RedirectType.replace);

frontend/src/utils/message-plans.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export async function countRoutingConfigs(
6464
return data.count;
6565
}
6666

67-
export async function getMessagePlan(
67+
export async function getRoutingConfig(
6868
routingConfigId: string
6969
): Promise<RoutingConfig | undefined> {
7070
const { accessToken } = await getSessionServer();
@@ -123,9 +123,9 @@ export async function createRoutingConfig(
123123
return data;
124124
}
125125

126-
export async function updateMessagePlan(
126+
export async function updateRoutingConfig(
127127
routingConfigId: string,
128-
updatedMessagePlan: RoutingConfig
128+
updatedRoutingConfig: RoutingConfig
129129
): Promise<RoutingConfig | undefined> {
130130
const { accessToken } = await getSessionServer();
131131

@@ -136,7 +136,7 @@ export async function updateMessagePlan(
136136
const { data, error } = await routingConfigurationApiClient.update(
137137
accessToken,
138138
routingConfigId,
139-
updatedMessagePlan
139+
updatedRoutingConfig
140140
);
141141

142142
if (error) {

0 commit comments

Comments
 (0)