-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Only send out one document if author == maintainer
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,4 +134,28 @@ describe('The Notification API', (): void => { | |
}) | ||
).to.be.true | ||
}) | ||
it('should not send both documents when the maintainer is the author', async (): Promise<void> => { | ||
const notification = new Notification(configuration, '', confluence, transportStub) | ||
const documentInfo = new DocumentInfo(0, 'maintainer', moment(), 'message', 'Test2', ['main', 'Test'], 'http://example.com', 'test') | ||
await notification.notify([documentInfo]) | ||
chai.expect((transportStub as unknown as SinonStubbedInstance<Mail>).sendMail.calledOnce).to.be.true | ||
chai.expect( | ||
(transportStub as unknown as SinonStubbedInstance<Mail>).sendMail.calledWith({ | ||
from: 'Notification <[email protected]>', | ||
to: '[email protected]', | ||
subject: Handlebars.compile(MockServer.NOTIFICATION_SUBJECT)({ | ||
author: '[email protected]', | ||
documentsCount: 1, | ||
documents: [documentInfo], | ||
multipleDocuments: false, | ||
}), | ||
html: Handlebars.compile(MockServer.NOTIFICATION_BODY)({ | ||
author: '[email protected]', | ||
documentsCount: 1, | ||
documents: [documentInfo], | ||
multipleDocuments: false, | ||
}), | ||
}) | ||
).to.be.true | ||
}) | ||
}) |