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:
Henrik Edegård
2025-09-24 07:55:22 +00:00
parent 93e1aa0133
commit 49be37008c
2 changed files with 2 additions and 2 deletions
@@ -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),