-
-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
84 additions
and
53 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Datadog integration Should call datadog webhook for archived toggle 1`] = `"{"text":"%%% \\n *[email protected]* archived *some-toggle* in project ** \\n %%% ","title":"Unleash notification update"}"`; | ||
exports[`Datadog integration Should call datadog webhook for archived toggle 1`] = `"{"text":"%%% \\n **[email protected]** archived **some-toggle** in project **** \\n %%% ","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should call datadog webhook for archived toggle with project info 1`] = `"{"text":"%%% \\n *[email protected]* archived *some-toggle* in project *[some-project](http://some-url.com/projects/some-project)* \\n %%% ","title":"Unleash notification update"}"`; | ||
exports[`Datadog integration Should call datadog webhook for archived toggle with project info 1`] = `"{"text":"%%% \\n **[email protected]** archived **some-toggle** in project **[some-project](http://some-url.com/projects/some-project)** \\n %%% ","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should call datadog webhook 1`] = `"{"text":"%%% \\n *[email protected]* created *[some-toggle](http://some-url.com/projects//features/some-toggle)* in project ** \\n %%% ","title":"Unleash notification update"}"`; | ||
exports[`Datadog integration Should call datadog webhook 1`] = `"{"text":"%%% \\n **[email protected]** created **[some-toggle](http://some-url.com/projects//features/some-toggle)** in project **** \\n %%% ","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should call datadog webhook for toggled environment 1`] = `"{"text":"%%% \\n *[email protected]* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update"}"`; | ||
exports[`Datadog integration Should call datadog webhook for toggled environment 1`] = `"{"text":"%%% \\n **[email protected]** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should call datadog webhook with JSON when template set 1`] = `"{"text":"{\\n \\"event\\": \\"feature-created\\",\\n \\"createdBy\\": \\"some@user.com\\"\\n}","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should include customHeaders in headers when calling service 1`] = `"{"text":"%%% \\n *[email protected]* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update"}"`; | ||
exports[`Datadog integration Should include customHeaders in headers when calling service 1`] = `"{"text":"%%% \\n **[email protected]** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update"}"`; | ||
|
||
exports[`Datadog integration Should include customHeaders in headers when calling service 2`] = ` | ||
{ | ||
|
@@ -20,7 +20,7 @@ exports[`Datadog integration Should include customHeaders in headers when callin | |
} | ||
`; | ||
|
||
exports[`Datadog integration Should not include source_type_name when included in the config 1`] = `"{"text":"%%% \\n *[email protected]* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)* \\n %%% ","title":"Unleash notification update","source_type_name":"my-custom-source-type"}"`; | ||
exports[`Datadog integration Should not include source_type_name when included in the config 1`] = `"{"text":"%%% \\n **[email protected]** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)** \\n %%% ","title":"Unleash notification update","source_type_name":"my-custom-source-type"}"`; | ||
|
||
exports[`Datadog integration Should not include source_type_name when included in the config 2`] = ` | ||
{ | ||
|
90 changes: 60 additions & 30 deletions
90
src/lib/addons/__snapshots__/feature-event-formatter-md.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Slack integration Should call slack webhook 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*[email protected]* created *<http://some-url.com/projects/default/features/some-toggle|some-toggle>* in project *<http://some-url.com/projects/default|default>*","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
exports[`Slack integration Should call slack webhook 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**[email protected]** created **<http://some-url.com/projects/default/features/some-toggle|some-toggle>** in project **<http://some-url.com/projects/default|default>**","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
|
||
exports[`Slack integration Should call slack webhook for archived toggle 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*[email protected]* archived *some-toggle* in project **","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects//archive"}]}]}"`; | ||
exports[`Slack integration Should call slack webhook for archived toggle 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**[email protected]** archived **some-toggle** in project ****","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects//archive"}]}]}"`; | ||
|
||
exports[`Slack integration Should call slack webhook for archived toggle with project info 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*[email protected]* archived *some-toggle* in project *<http://some-url.com/projects/some-project|some-project>*","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/some-project/archive"}]}]}"`; | ||
exports[`Slack integration Should call slack webhook for archived toggle with project info 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**[email protected]** archived **some-toggle** in project **<http://some-url.com/projects/some-project|some-project>**","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/some-project/archive"}]}]}"`; | ||
|
||
exports[`Slack integration Should call webhook for toggled environment 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*[email protected]* disabled *<http://some-url.com/projects/default/features/some-toggle|some-toggle>* for the *development* environment in project *<http://some-url.com/projects/default|default>*","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
exports[`Slack integration Should call webhook for toggled environment 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**[email protected]** disabled **<http://some-url.com/projects/default/features/some-toggle|some-toggle>** for the **development** environment in project **<http://some-url.com/projects/default|default>**","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
|
||
exports[`Slack integration Should include custom headers from parameters in call to service 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"*[email protected]* disabled *<http://some-url.com/projects/default/features/some-toggle|some-toggle>* for the *development* environment in project *<http://some-url.com/projects/default|default>*","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
exports[`Slack integration Should include custom headers from parameters in call to service 1`] = `"{"username":"Unleash","icon_emoji":":unleash:","text":"**[email protected]** disabled **<http://some-url.com/projects/default/features/some-toggle|some-toggle>** for the **development** environment in project **<http://some-url.com/projects/default|default>**","channel":"#general","attachments":[{"actions":[{"name":"featureToggle","text":"Open in Unleash","type":"button","value":"featureToggle","style":"primary","url":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
|
||
exports[`Slack integration Should include custom headers from parameters in call to service 2`] = ` | ||
{ | ||
|
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Teams integration Should call teams webhook 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*[email protected]* created *[some-toggle](http://some-url.com/projects//features/some-toggle)* in project **","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-created"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//features/some-toggle"}]}]}"`; | ||
exports[`Teams integration Should call teams webhook 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**[email protected]** created **[some-toggle](http://some-url.com/projects//features/some-toggle)** in project ****","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-created"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//features/some-toggle"}]}]}"`; | ||
|
||
exports[`Teams integration Should call teams webhook for archived toggle 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*[email protected]* archived *some-toggle* in project **","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//archive"}]}]}"`; | ||
exports[`Teams integration Should call teams webhook for archived toggle 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**[email protected]** archived **some-toggle** in project ****","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects//archive"}]}]}"`; | ||
|
||
exports[`Teams integration Should call teams webhook for archived toggle with project info 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*[email protected]* archived *some-toggle* in project *[some-project](http://some-url.com/projects/some-project)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/some-project/archive"}]}]}"`; | ||
exports[`Teams integration Should call teams webhook for archived toggle with project info 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**[email protected]** archived **some-toggle** in project **[some-project](http://some-url.com/projects/some-project)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-archived"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/some-project/archive"}]}]}"`; | ||
|
||
exports[`Teams integration Should call teams webhook for toggled environment 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*[email protected]* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
exports[`Teams integration Should call teams webhook for toggled environment 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**[email protected]** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
|
||
exports[`Teams integration Should include custom headers in call to teams 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"*[email protected]* disabled *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* for the *development* environment in project *[default](http://some-url.com/projects/default)*","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
exports[`Teams integration Should include custom headers in call to teams 1`] = `"{"themeColor":"0076D7","summary":"Message","sections":[{"activityTitle":"**[email protected]** disabled **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** for the **development** environment in project **[default](http://some-url.com/projects/default)**","activitySubtitle":"Unleash notification update","facts":[{"name":"User","value":"[email protected]"},{"name":"Action","value":"feature-environment-disabled"}]}],"potentialAction":[{"@type":"OpenUri","name":"Go to feature","targets":[{"os":"default","uri":"http://some-url.com/projects/default/features/some-toggle"}]}]}"`; | ||
|
||
exports[`Teams integration Should include custom headers in call to teams 2`] = ` | ||
{ | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
exports[`Webhook integration should allow for eventJson and eventMarkdown in bodyTemplate 1`] = ` | ||
"{ | ||
"json": "{\\"id\\":1,\\"createdAt\\":\\"2024-07-24T00:00:00.000Z\\",\\"createdByUserId\\":-1337,\\"type\\":\\"feature-created\\",\\"createdBy\\":\\"some@user.com\\",\\"featureName\\":\\"some-toggle\\",\\"project\\":\\"default\\",\\"data\\":{\\"name\\":\\"some-toggle\\",\\"enabled\\":false,\\"strategies\\":[{\\"name\\":\\"default\\"}]}}", | ||
"markdown": "*[email protected]* created *[some-toggle](http://some-url.com/projects/default/features/some-toggle)* in project *[default](http://some-url.com/projects/default)*" | ||
"markdown": "**[email protected]** created **[some-toggle](http://some-url.com/projects/default/features/some-toggle)** in project **[default](http://some-url.com/projects/default)**" | ||
}" | ||
`; |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ import { | |
} from '../types'; | ||
import type { IntegrationEventsService } from '../services'; | ||
import type { Logger } from '../logger'; | ||
import { bold } from './feature-event-formatter-md'; | ||
|
||
const slackApiCalls: ChatPostMessageArguments[] = []; | ||
|
||
|
@@ -271,8 +272,7 @@ describe('SlackAppAddon', () => { | |
event: serializeDates(eventWith2Tags), | ||
details: { | ||
channels: ['general', 'another-channel-1', 'another-channel-2'], | ||
message: | ||
'*[email protected]* enabled *<http://some-url.com/projects/default/features/some-toggle|some-toggle>* for the *development* environment in project *<http://some-url.com/projects/default|default>*', | ||
message: `${bold('[email protected]')} enabled ${bold('<http://some-url.com/projects/default/features/some-toggle|some-toggle>')} for the ${bold('development')} environment in project ${bold('<http://some-url.com/projects/default|default>')}`, | ||
}, | ||
}); | ||
}); | ||
|
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ import { | |
SYSTEM_USER_ID, | ||
} from '../types'; | ||
import type { IntegrationEventsService } from '../services'; | ||
import { bold } from './feature-event-formatter-md'; | ||
|
||
let fetchRetryCalls: any[] = []; | ||
const registerEventMock = jest.fn(); | ||
|
@@ -338,8 +339,7 @@ describe('Slack integration', () => { | |
url: parameters.url, | ||
channels: ['general'], | ||
username: 'Unleash', | ||
message: | ||
'*[email protected]* disabled *<http://some-url.com/projects/default/features/some-toggle|some-toggle>* for the *development* environment in project *<http://some-url.com/projects/default|default>*', | ||
message: `${bold('[email protected]')} disabled ${bold('<http://some-url.com/projects/default/features/some-toggle|some-toggle>')} for the ${bold('development')} environment in project ${bold('<http://some-url.com/projects/default|default>')}`, | ||
}, | ||
}); | ||
}); | ||
|
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