Skip to content

Commit 5698464

Browse files
CCM-13012: Add supplierReferences test
1 parent 135cb39 commit 5698464

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

tests/test-team/template-mgmt-api-tests/update-routing-config.api.spec.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,67 @@ test.describe('PUT /v1/routing-configuration/:routingConfigId', () => {
424424
expect(updated.data.createdAt).toEqual(routingConfig.dbEntry.createdAt);
425425
});
426426

427+
test('cascade and cascadeGroupOverrides with supplierReferences - returns 200 and the updated routing config data', async ({
428+
request,
429+
}) => {
430+
const routingConfig = RoutingConfigFactory.create(user1, {
431+
cascade: [{
432+
cascadeGroups: ['standard'],
433+
channel: 'LETTER',
434+
channelType: 'primary',
435+
defaultTemplateId: 'template-id',
436+
supplierReferences: {
437+
MBA: 'supplier-template-id'
438+
}
439+
}]
440+
});
441+
442+
await storageHelper.seed([routingConfig.dbEntry]);
443+
444+
const update = {
445+
cascade: [
446+
{
447+
cascadeGroups: ['standard'],
448+
channel: 'EMAIL',
449+
channelType: 'primary',
450+
defaultTemplateId: null,
451+
},
452+
],
453+
cascadeGroupOverrides: [],
454+
};
455+
456+
const start = new Date();
457+
458+
const updateResponse = await request.put(
459+
`${process.env.API_BASE_URL}/v1/routing-configuration/${routingConfig.dbEntry.id}`,
460+
{
461+
headers: {
462+
Authorization: await user1.getAccessToken(),
463+
},
464+
data: update,
465+
}
466+
);
467+
468+
expect(updateResponse.status()).toBe(200);
469+
470+
const updated = await updateResponse.json();
471+
472+
expect(updated).toEqual({
473+
statusCode: 200,
474+
data: {
475+
...routingConfig.apiResponse,
476+
...update,
477+
updatedAt: expect.stringMatching(isoDateRegExp),
478+
},
479+
});
480+
481+
expect(updated.data.updatedAt).toBeDateRoughlyBetween([
482+
start,
483+
new Date(),
484+
]);
485+
expect(updated.data.createdAt).toEqual(routingConfig.dbEntry.createdAt);
486+
});
487+
427488
test('cascade without cascadeGroupOverrides - returns 400', async ({
428489
request,
429490
}) => {

0 commit comments

Comments
 (0)