Skip to content

Commit

Permalink
test: sender name and preheader promoted
Browse files Browse the repository at this point in the history
  • Loading branch information
ainouzgali committed Feb 14, 2024
1 parent d0abbf2 commit f1d0923
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
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

0 comments on commit f1d0923

Please sign in to comment.