Simplified more. The Slack library will remove undefined values when sending the actual request.
Signed-off-by: Henrik Edegård <henrik.edegard@fortnox.se>
This commit is contained in:
+1
-1
@@ -829,7 +829,7 @@ describe('SlackNotificationProcessor', () => {
|
||||
|
||||
const calls = (slack.chat.postMessage as jest.Mock).mock.calls;
|
||||
expect(calls).toHaveLength(1);
|
||||
expect(calls[0][0]).not.toHaveProperty('username');
|
||||
expect(calls[0][0].username).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ export function toChatPostMessageArgs(options: {
|
||||
const args: ChatPostMessageArguments = {
|
||||
channel,
|
||||
text: payload.title,
|
||||
...(username && { username }),
|
||||
username,
|
||||
attachments: [
|
||||
{
|
||||
color: getColor(payload.severity),
|
||||
|
||||
Reference in New Issue
Block a user