Skip to content

Commit

Permalink
Merge branch 'master' into je-db-links
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanedey authored Mar 25, 2024
2 parents 3dad218 + e42840c commit c7a5206
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/actions/send-email/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 22 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/messaging/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class Messaging {

return this.getUrlPath()
.then((urlPath) => {
const requests: Promise<SendResponse>[] = copy.map((message) => {
const requests: Promise<SendResponse>[] = copy.map(async (message) => {
validateMessage(message);
const request: { message: Message; validate_only?: boolean } = { message };
if (dryRun) {
Expand Down
13 changes: 13 additions & 0 deletions test/unit/messaging/messaging.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,19 @@ describe('Messaging', () => {
.should.eventually.be.rejectedWith('Exactly one of topic, token or condition is required');
});

it('should reject a message when it does not pass local validation, but still try the other messages', () => {
const invalidMessage: Message = { token: 'a', notification: { imageUrl: 'abc' } };
const messageIds = [
'projects/projec_id/messages/1',
];
messageIds.forEach(id => mockedRequests.push(mockSendRequest(id)))
return messaging.sendEach([invalidMessage, validMessage])
.then((response: BatchResponse) => {
expect(response.successCount).to.equal(1);
expect(response.failureCount).to.equal(1);
});
});

const invalidDryRun = [null, NaN, 0, 1, '', 'a', [], [1, 'a'], {}, { a: 1 }, _.noop];
invalidDryRun.forEach((dryRun) => {
it(`should throw given invalid dryRun parameter: ${JSON.stringify(dryRun)}`, () => {
Expand Down

0 comments on commit c7a5206

Please sign in to comment.