Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sender name and preheader not promoted #5193

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export class PromoteMessageTemplateChange {
content: newItem.content,
contentType: newItem.contentType,
title: newItem.title,
preheader: newItem.preheader,
senderName: newItem.senderName,
cta: newItem.cta,
active: newItem.active,
actor: newItem.actor,
Expand Down Expand Up @@ -87,6 +89,8 @@ export class PromoteMessageTemplateChange {
contentType: newItem.contentType,
title: newItem.title,
cta: newItem.cta,
preheader: newItem.preheader,
senderName: newItem.senderName,
active: newItem.active,
actor: newItem.actor,
variables: newItem.variables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('Create Workflow - /workflows (POST)', async () => {
name: 'Message Name',
subject: 'Test email subject',
preheader: 'Test email preheader',
senderName: 'Test email sender name',
content: [{ type: EmailBlockTypeEnum.TEXT, content: 'This is a sample text block' }],
type: StepTypeEnum.EMAIL,
},
Expand All @@ -102,6 +103,7 @@ describe('Create Workflow - /workflows (POST)', async () => {
name: 'Better Message Template',
subject: 'Better subject',
preheader: 'Better pre header',
senderName: 'Better pre sender name',
content: [{ type: EmailBlockTypeEnum.TEXT, content: 'This is a sample of Better text block' }],
type: StepTypeEnum.EMAIL,
},
Expand Down Expand Up @@ -144,6 +146,7 @@ describe('Create Workflow - /workflows (POST)', async () => {
expect(message?.template?.active).to.equal(defaultMessageIsActive);
expect(message?.template?.subject).to.equal(`${messageRequest?.template?.subject}`);
expect(message?.template?.preheader).to.equal(`${messageRequest?.template?.preheader}`);
expect(message?.template?.senderName).to.equal(`${messageRequest?.template?.senderName}`);

const filters = message?.filters ? message?.filters[0] : null;
expect(filters?.type).to.equal(filtersTest?.type);
Expand All @@ -159,6 +162,7 @@ describe('Create Workflow - /workflows (POST)', async () => {
expect(variantResult?.template?.active).to.equal(variantRequest?.active);
expect(variantResult?.template?.subject).to.equal(variantRequest?.template?.subject);
expect(variantResult?.template?.preheader).to.equal(variantRequest?.template?.preheader);
expect(variantResult?.template?.senderName).to.equal(variantRequest?.template?.senderName);

if (Array.isArray(message?.template?.content) && Array.isArray(messageRequest?.template?.content)) {
expect(message?.template?.content[0].type).to.equal(messageRequest?.template?.content[0].type);
Expand Down Expand Up @@ -206,6 +210,8 @@ describe('Create Workflow - /workflows (POST)', async () => {
expect(message?.template?.type).to.equal(prodVersionMessage?.type);
expect(message?.template?.content).to.deep.equal(prodVersionMessage?.content);
expect(message?.template?.active).to.equal(prodVersionMessage?.active);
expect(message?.template?.preheader).to.equal(prodVersionMessage?.preheader);
expect(message?.template?.senderName).to.equal(prodVersionMessage?.senderName);

const prodVersionVariant = await messageTemplateRepository.findOne({
_environmentId: prodEnv._id,
Expand All @@ -217,6 +223,8 @@ describe('Create Workflow - /workflows (POST)', async () => {
expect(variantResult?.template?.type).to.equal(prodVersionVariant?.type);
expect(variantResult?.template?.content).to.deep.equal(prodVersionVariant?.content);
expect(variantResult?.template?.active).to.equal(prodVersionVariant?.active);
expect(variantResult?.template?.preheader).to.equal(prodVersionVariant?.preheader);
expect(variantResult?.template?.senderName).to.equal(prodVersionVariant?.senderName);
});

it('should create a valid notification', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ describe('Update workflow by id - /workflows/:workflowId (PUT)', async () => {
name: 'Message Name',
subject: 'Test email subject',
preheader: 'Test email preheader',
senderName: 'Test email sender name',
type: StepTypeEnum.EMAIL,
content: [],
},
Expand Down Expand Up @@ -272,7 +273,8 @@ describe('Update workflow by id - /workflows/:workflowId (PUT)', async () => {
template: {
name: 'Message Name',
subject: 'Test email subject',
preheader: '',
preheader: 'updated preheader',
senderName: 'updated sender name',
type: StepTypeEnum.EMAIL,
content: [],
cta: null,
Expand All @@ -298,7 +300,8 @@ describe('Update workflow by id - /workflows/:workflowId (PUT)', async () => {
const steps = updated.data.steps;

expect(steps[0]._parentId).to.equal(null);
expect(steps[0].template.preheader).to.equal('');
expect(steps[0].template.preheader).to.equal('updated preheader');
expect(steps[0].template.senderName).to.equal('updated sender name');
expect(steps[0]._id).to.equal(steps[1]._parentId);
expect(steps[1]._id).to.equal(steps[2]._parentId);
});
Expand Down
Loading