Skip to content

Commit b987d50

Browse files
committed
CCM-12736: update assertions
1 parent cb560fe commit b987d50

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

tests/test-team/helpers/db/routing-config-storage-helper.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
22
import {
33
BatchWriteCommand,
44
DynamoDBDocumentClient,
5-
GetCommand,
65
} from '@aws-sdk/lib-dynamodb';
7-
import type { RoutingConfigDbEntry } from 'helpers/types';
86
import type { RoutingConfig } from 'nhs-notify-backend-client';
97

108
type RoutingConfigKey = { id: string; clientId: string };
@@ -18,20 +16,6 @@ export class RoutingConfigStorageHelper {
1816

1917
private adHocKeys: RoutingConfigKey[] = [];
2018

21-
async get(key: RoutingConfigKey): Promise<RoutingConfigDbEntry | null> {
22-
const { Item } = await this.dynamo.send(
23-
new GetCommand({
24-
TableName: process.env.ROUTING_CONFIG_TABLE_NAME,
25-
Key: {
26-
id: key.id,
27-
owner: this.clientOwnerKey(key.clientId),
28-
},
29-
})
30-
);
31-
32-
return Item as RoutingConfigDbEntry;
33-
}
34-
3519
/**
3620
* Seed a load of routing configs into the database
3721
*/

tests/test-team/template-mgmt-routing-component-tests/create-message-plan.routing-component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ test.describe('Create Message Plan Page', () => {
199199
page: createMessagePlanPage,
200200
id: '',
201201
baseURL,
202-
expectedUrl: '/templates/message-plans/choose-message-order',
202+
expectedUrl: 'templates/message-plans/choose-message-order',
203203
};
204204

205205
await assertSkipToMainContent(props);

tests/test-team/template-mgmt-routing-component-tests/edit-message-plan-settings.routing-component.spec.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ test('common page tests', async ({ page, baseURL }) => {
5555
page: editPage,
5656
id: plan.dbEntry.id,
5757
baseURL,
58-
expectedUrl: `/templates/message-plans/choose-templates/${plan.dbEntry.id}`,
58+
expectedUrl: `templates/message-plans/choose-templates/${plan.dbEntry.id}`,
5959
};
6060

6161
await assertSkipToMainContent(props);
@@ -101,10 +101,14 @@ test.describe('single campaign client', () => {
101101
`${baseURL}/templates/message-plans/choose-templates/${plan.dbEntry.id}`
102102
);
103103

104-
const latest = await storageHelper.get(plan.dbEntry);
104+
// reload the edit page - should display the latest data
105+
await editPage.loadPage(plan.dbEntry.id);
106+
107+
await expect(editPage.nameField).toHaveValue('New name!');
105108

106-
expect(latest?.name).toBe('New name!');
107-
expect(latest?.campaignId).toBe(plan.dbEntry.campaignId);
109+
await expect(editPage.singleCampaignIdElement).toHaveText(
110+
plan.dbEntry.campaignId
111+
);
108112
});
109113

110114
test('displays error if name is empty', async ({ page }) => {
@@ -182,10 +186,14 @@ test.describe('client has multiple campaigns', () => {
182186
`${baseURL}/templates/message-plans/choose-templates/${plan.dbEntry.id}`
183187
);
184188

185-
const latest = await storageHelper.get(plan.dbEntry);
189+
// reload the edit page - should display the latest data
190+
await editPage.loadPage(plan.dbEntry.id);
191+
192+
await expect(editPage.nameField).toHaveValue('Updated name');
186193

187-
expect(latest?.name).toBe('Updated name');
188-
expect(latest?.campaignId).toBe(userWithMultipleCampaigns.campaignIds?.[1]);
194+
await expect(editPage.campaignIdSelector).toHaveValue(
195+
userWithMultipleCampaigns.campaignIds?.[1] as string
196+
);
189197
});
190198

191199
test('displays error if campaign id is not selected', async ({ page }) => {

0 commit comments

Comments
 (0)