fix: Account for system messages in flag slack alert

This commit is contained in:
Blade Barringer
2016-09-02 15:23:56 -05:00
parent 36d3ac4611
commit 173b3f3f84
2 changed files with 25 additions and 1 deletions

View File

@@ -97,6 +97,23 @@ describe('slack', () => {
});
});
it('provides name for system message', () => {
message.uuid = 'system';
delete message.user;
slack.sendFlagNotification({
flagger,
group,
message,
});
expect(IncomingWebhook.prototype.send).to.be.calledWithMatch({
attachments: [sandbox.match({
author_name: 'System Message',
})],
});
});
it('noops if no flagging url is provided', () => {
sandbox.stub(nconf, 'get').withArgs('SLACK:FLAGGING_URL').returns('');
sandbox.stub(logger, 'error');