Skip to content

Commit

Permalink
Add missing test for regular type
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcL committed May 10, 2020
1 parent c7b4be8 commit cad2f5e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/mailchimp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,34 @@ describe('Mailchimp', () => {
},
});
});

it('should call Mailchimp client post method with regular type if none passed', async () => {
expect.assertions(1);
const givenOptions = {
listId: 'expectedListId',
subject: 'expectedSubject',
preview: 'expectedPreview',
title: 'expectedTitle',
fromName: 'expectedFromName',
replyTo: 'expectedReplyTo',
};

await mailchimp.createCampaign(givenOptions);

expect(mockMailchimpPost).toHaveBeenCalledWith('/campaigns', {
type: 'regular',
recipients: {
list_id: 'expectedListId',
},
settings: {
subject_line: 'expectedSubject',
preview_text: 'expectedPreview',
title: 'expectedTitle',
from_name: 'expectedFromName',
reply_to: 'expectedReplyTo',
to_name: '*|FNAME|*',
},
});
});
});
});

0 comments on commit cad2f5e

Please sign in to comment.