-
-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checkpoint for adding createdByUserId to all events
- Loading branch information
Showing
18 changed files
with
355 additions
and
58 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 |
---|---|---|
|
@@ -45,6 +45,7 @@ test('Should call datadog webhook', async () => { | |
createdAt: new Date(), | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
createdByUserId: -1337, | ||
featureName: 'some-toggle', | ||
data: { | ||
name: 'some-toggle', | ||
|
@@ -74,6 +75,7 @@ test('Should call datadog webhook for archived toggle', async () => { | |
createdAt: new Date(), | ||
type: FEATURE_ARCHIVED, | ||
createdBy: '[email protected]', | ||
createdByUserId: -1337, | ||
featureName: 'some-toggle', | ||
data: { | ||
name: 'some-toggle', | ||
|
@@ -102,6 +104,7 @@ test('Should call datadog webhook for archived toggle with project info', async | |
type: FEATURE_ARCHIVED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
createdByUserId: -1337, | ||
project: 'some-project', | ||
data: { | ||
name: 'some-toggle', | ||
|
@@ -129,6 +132,7 @@ test('Should call datadog webhook for toggled environment', async () => { | |
createdAt: new Date(), | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
createdByUserId: -1337, | ||
environment: 'development', | ||
project: 'default', | ||
featureName: 'some-toggle', | ||
|
@@ -160,6 +164,7 @@ test('Should include customHeaders in headers when calling service', async () => | |
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
environment: 'development', | ||
createdByUserId: -1337, | ||
project: 'default', | ||
featureName: 'some-toggle', | ||
data: { | ||
|
@@ -190,6 +195,7 @@ test('Should not include source_type_name when included in the config', async () | |
createdAt: new Date(), | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
createdByUserId: -1337, | ||
environment: 'development', | ||
project: 'default', | ||
featureName: 'some-toggle', | ||
|
@@ -224,6 +230,7 @@ test('Should call datadog webhook with JSON when template set', async () => { | |
createdAt: new Date(), | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
createdByUserId: -1337, | ||
featureName: 'some-toggle', | ||
data: { | ||
name: 'some-toggle', | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import { | |
FEATURE_STRATEGY_REMOVE, | ||
FEATURE_STRATEGY_UPDATE, | ||
IEvent, | ||
SYSTEM_USER_ID, | ||
} from '../types'; | ||
|
||
import { FeatureEventFormatterMd } from './feature-event-formatter-md'; | ||
|
@@ -34,6 +35,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -67,6 +69,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -100,6 +103,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -133,6 +137,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -174,6 +179,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -207,6 +213,7 @@ const testCases: [string, IEvent][] = [ | |
id: 919, | ||
type: FEATURE_STRATEGY_ADD, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:08.290Z'), | ||
data: { | ||
id: '3f4bf713-696c-43a4-8ce7-d6c607108858', | ||
|
@@ -231,6 +238,7 @@ const testCases: [string, IEvent][] = [ | |
id: 918, | ||
type: FEATURE_STRATEGY_REMOVE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:00.229Z'), | ||
data: null, | ||
preData: { | ||
|
@@ -253,6 +261,7 @@ const testCases: [string, IEvent][] = [ | |
id: 39, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: 'admin', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2023-02-20T20:23:28.791Z'), | ||
data: { | ||
id: 'f2d34aac-52ec-49d2-82d3-08d710e89eaa', | ||
|
@@ -310,6 +319,7 @@ const testCases: [string, IEvent][] = [ | |
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: 'admin', | ||
createdAt: new Date('2023-02-20T20:23:28.791Z'), | ||
createdByUserId: SYSTEM_USER_ID, | ||
data: { | ||
id: 'f2d34aac-52ec-49d2-82d3-08d710e89eaa', | ||
name: 'default', | ||
|
@@ -346,6 +356,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
name: 'userWithId', | ||
|
@@ -385,6 +396,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
name: 'remoteAddress', | ||
|
@@ -421,6 +433,7 @@ const testCases: [string, IEvent][] = [ | |
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
createdByUserId: SYSTEM_USER_ID, | ||
data: { | ||
name: 'applicationHostname', | ||
constraints: [ | ||
|
@@ -456,6 +469,7 @@ const testCases: [string, IEvent][] = [ | |
type: FEATURE_STRATEGY_UPDATE, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
createdByUserId: SYSTEM_USER_ID, | ||
data: { | ||
name: 'newStrategy', | ||
constraints: [ | ||
|
@@ -491,6 +505,7 @@ const testCases: [string, IEvent][] = [ | |
type: CHANGE_REQUEST_SCHEDULED, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
createdByUserId: SYSTEM_USER_ID, | ||
data: { | ||
changeRequestId: 1, | ||
}, | ||
|
@@ -508,6 +523,7 @@ const testCases: [string, IEvent][] = [ | |
type: CHANGE_REQUEST_SCHEDULED_APPLICATION_SUCCESS, | ||
createdBy: '[email protected]', | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
createdByUserId: SYSTEM_USER_ID, | ||
data: { | ||
changeRequestId: 1, | ||
}, | ||
|
@@ -524,6 +540,7 @@ const testCases: [string, IEvent][] = [ | |
id: 920, | ||
type: CHANGE_REQUEST_SCHEDULED_APPLICATION_FAILURE, | ||
createdBy: '[email protected]', | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdAt: new Date('2022-06-01T10:03:11.549Z'), | ||
data: { | ||
changeRequestId: 1, | ||
|
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,4 +1,8 @@ | ||
import { IEvent, FEATURE_ENVIRONMENT_ENABLED } from '../types/events'; | ||
import { | ||
IEvent, | ||
FEATURE_ENVIRONMENT_ENABLED, | ||
SYSTEM_USER_ID, | ||
} from '../types/events'; | ||
import SlackAppAddon from './slack-app'; | ||
import { ChatPostMessageArguments, ErrorCode } from '@slack/web-api'; | ||
|
||
|
@@ -44,6 +48,7 @@ describe('SlackAppAddon', () => { | |
id: 1, | ||
createdAt: new Date(), | ||
type: FEATURE_ENVIRONMENT_ENABLED, | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdBy: '[email protected]', | ||
project: 'default', | ||
featureName: 'some-toggle', | ||
|
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,7 @@ import { | |
FEATURE_ARCHIVED, | ||
FEATURE_ENVIRONMENT_DISABLED, | ||
IEvent, | ||
SYSTEM_USER_ID, | ||
} from '../types/events'; | ||
import { Logger } from '../logger'; | ||
|
||
|
@@ -44,6 +45,7 @@ test('Should call slack webhook', async () => { | |
id: 1, | ||
createdAt: new Date(), | ||
type: FEATURE_CREATED, | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdBy: '[email protected]', | ||
project: 'default', | ||
featureName: 'some-toggle', | ||
|
@@ -74,6 +76,7 @@ test('Should call slack webhook for archived toggle', async () => { | |
const event: IEvent = { | ||
id: 2, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ARCHIVED, | ||
featureName: 'some-toggle', | ||
createdBy: '[email protected]', | ||
|
@@ -101,6 +104,7 @@ test('Should call slack webhook for archived toggle with project info', async () | |
const event: IEvent = { | ||
id: 2, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ARCHIVED, | ||
featureName: 'some-toggle', | ||
project: 'some-project', | ||
|
@@ -129,6 +133,7 @@ test(`Should call webhook for toggled environment`, async () => { | |
const event: IEvent = { | ||
id: 2, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
environment: 'development', | ||
|
@@ -159,6 +164,7 @@ test('Should use default channel', async () => { | |
const event: IEvent = { | ||
id: 3, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -189,6 +195,7 @@ test('Should override default channel with data from tag', async () => { | |
const event: IEvent = { | ||
id: 4, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -225,6 +232,7 @@ test('Should post to all channels in tags', async () => { | |
const event: IEvent = { | ||
id: 5, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -269,6 +277,7 @@ test('Should include custom headers from parameters in call to service', async ( | |
id: 2, | ||
createdAt: new Date(), | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdBy: '[email protected]', | ||
environment: 'development', | ||
project: '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 |
---|---|---|
|
@@ -5,6 +5,7 @@ import { | |
FEATURE_CREATED, | ||
FEATURE_ENVIRONMENT_DISABLED, | ||
IEvent, | ||
SYSTEM_USER_ID, | ||
} from '../types/events'; | ||
|
||
import TeamsAddon from './teams'; | ||
|
@@ -45,6 +46,7 @@ test('Should call teams webhook', async () => { | |
id: 1, | ||
createdAt: new Date(), | ||
type: FEATURE_CREATED, | ||
createdByUserId: SYSTEM_USER_ID, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
data: { | ||
|
@@ -72,6 +74,7 @@ test('Should call teams webhook for archived toggle', async () => { | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ARCHIVED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -98,6 +101,7 @@ test('Should call teams webhook for archived toggle with project info', async () | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ARCHIVED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -125,6 +129,7 @@ test(`Should call teams webhook for toggled environment`, async () => { | |
const event: IEvent = { | ||
id: 2, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
environment: 'development', | ||
|
@@ -154,6 +159,7 @@ test('Should include custom headers in call to teams', async () => { | |
const event: IEvent = { | ||
id: 2, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_ENVIRONMENT_DISABLED, | ||
createdBy: '[email protected]', | ||
environment: 'development', | ||
|
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,6 +1,6 @@ | ||
import { Logger } from '../logger'; | ||
|
||
import { FEATURE_CREATED, IEvent } from '../types/events'; | ||
import { FEATURE_CREATED, IEvent, SYSTEM_USER_ID } from '../types/events'; | ||
|
||
import WebhookAddon from './webhook'; | ||
|
||
|
@@ -36,6 +36,7 @@ test('Should handle event without "bodyTemplate"', () => { | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -61,6 +62,7 @@ test('Should format event with "bodyTemplate"', () => { | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -90,6 +92,7 @@ test('Should format event with "authorization"', () => { | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
@@ -120,6 +123,7 @@ test('Should handle custom headers', async () => { | |
const event: IEvent = { | ||
id: 1, | ||
createdAt: new Date(), | ||
createdByUserId: SYSTEM_USER_ID, | ||
type: FEATURE_CREATED, | ||
createdBy: '[email protected]', | ||
featureName: 'some-toggle', | ||
|
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
Oops, something went wrong.