Skip to content

Commit b3a0f62

Browse files
committed
CCM-11496: fixes
1 parent 5295d1f commit b3a0f62

File tree

5 files changed

+38
-11
lines changed

5 files changed

+38
-11
lines changed

frontend/src/app/message-plans/move-to-production/[routingConfigId]/__snapshots__/page.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ exports[`matches snapshot 1`] = `
5454
Moving message plans from draft to production means that they are ready to send.
5555
</p>
5656
<p>
57-
Messages will only be sent to recipients when you make a request with
57+
Messages will only be sent to recipients when you make a request with
5858
<a
5959
href="https://digital.nhs.uk/developer/api-catalogue/nhs-notify"
6060
rel="noopener noreferrer"
6161
target="_blank"
6262
>
6363
NHS Notify API
6464
</a>
65-
or
65+
or
6666
<a
6767
href="https://digital.nhs.uk/developer/api-catalogue/nhs-notify-mesh"
6868
rel="noopener noreferrer"

frontend/src/utils/form-actions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ export async function createRoutingConfig(
219219
export async function submitRoutingConfig(id: string) {
220220
const { accessToken } = await getSessionServer();
221221

222-
console.log({ accessToken });
223-
224222
if (!accessToken) {
225223
throw new Error('Failed to get access token');
226224
}

lambdas/backend-client/src/routing-config-api-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const routingConfigurationApiClient = {
167167
}
168168

169169
const url =
170-
`/v1/routing-configuration/${id}/submit` satisfies OpenApiToTemplate<
170+
`/v1/routing-configuration/${parseResult.data}/submit` satisfies OpenApiToTemplate<
171171
PatchV1RoutingConfigurationByRoutingConfigIdSubmitData['url']
172172
>;
173173

scripts/config/pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: trailing-whitespace
66
exclude: |
77
(?x)^(
8-
frontend/src/__tests__/.*\.tsx\.snap |
8+
frontend/src/.*\.tsx\.snap |
99
frontend/src/__tests__/utils/markdownit/fixtures/index\.ts
1010
)$
1111
- id: detect-aws-credentials

tests/test-team/template-mgmt-routing-component-tests/move-to-production-page.routing-component.spec.ts

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
assertSignOutLink,
1313
assertSkipToMainContent,
1414
} from 'helpers/template-mgmt-common.steps';
15+
import { RoutingMessagePlansPage } from 'pages/routing/message-plans-page';
1516
import { RoutingMoveToProductionPage } from 'pages/routing/move-to-production-page';
1617

1718
const storageHelper = new RoutingConfigStorageHelper();
@@ -53,7 +54,7 @@ test.describe('Create Message Plan Page', () => {
5354
const routingConfig =
5455
RoutingConfigFactory.create(user).withTemplates('NHSAPP');
5556

56-
storageHelper.seed([routingConfig.dbEntry]);
57+
await storageHelper.seed([routingConfig.dbEntry]);
5758

5859
const moveToProductionPage = new RoutingMoveToProductionPage(page);
5960

@@ -66,7 +67,21 @@ test.describe('Create Message Plan Page', () => {
6667
await moveToProductionPage.submitButton.click();
6768

6869
await expect(page).toHaveURL(`${baseURL}/templates/message-plans`);
69-
// TODO: CCM-11496 - assert status
70+
71+
const messagePlansPage = new RoutingMessagePlansPage(page);
72+
73+
await messagePlansPage.productionMessagePlansTable.click();
74+
75+
const productionIdCells =
76+
messagePlansPage.productionMessagePlansTable.getByTestId(
77+
'message-plan-id-cell'
78+
);
79+
80+
const productionCellsText = await productionIdCells.allTextContents();
81+
82+
expect(productionCellsText).toContainEqual(
83+
expect.stringContaining(routingConfig.dbEntry.id)
84+
);
7085
});
7186

7287
test('links to preview page for the message plan', async ({
@@ -76,7 +91,7 @@ test.describe('Create Message Plan Page', () => {
7691
const routingConfig =
7792
RoutingConfigFactory.create(user).withTemplates('NHSAPP');
7893

79-
storageHelper.seed([routingConfig.dbEntry]);
94+
await storageHelper.seed([routingConfig.dbEntry]);
8095

8196
const moveToProductionPage = new RoutingMoveToProductionPage(page);
8297

@@ -93,14 +108,14 @@ test.describe('Create Message Plan Page', () => {
93108
);
94109
});
95110

96-
test('cancel button links to the message plan list page', async ({
111+
test('cancel button links to the message plan list page, does not move the plan to production', async ({
97112
baseURL,
98113
page,
99114
}) => {
100115
const routingConfig =
101116
RoutingConfigFactory.create(user).withTemplates('NHSAPP');
102117

103-
storageHelper.seed([routingConfig.dbEntry]);
118+
await storageHelper.seed([routingConfig.dbEntry]);
104119

105120
const moveToProductionPage = new RoutingMoveToProductionPage(page);
106121

@@ -113,5 +128,19 @@ test.describe('Create Message Plan Page', () => {
113128
await moveToProductionPage.cancelLink.click();
114129

115130
await expect(page).toHaveURL(`${baseURL}/templates/message-plans`);
131+
132+
const messagePlansPage = new RoutingMessagePlansPage(page);
133+
134+
await messagePlansPage.draftMessagePlansTable.click();
135+
136+
const draftIdCells = messagePlansPage.draftMessagePlansTable.getByTestId(
137+
'message-plan-id-cell'
138+
);
139+
140+
const draftCellsText = await draftIdCells.allTextContents();
141+
142+
expect(draftCellsText).toContainEqual(
143+
expect.stringContaining(routingConfig.dbEntry.id)
144+
);
116145
});
117146
});

0 commit comments

Comments
 (0)