Skip to content

Commit d27b0f3

Browse files
saikumarrsAI Assistant
andcommitted
fix: validate integration (#2310)
Co-authored-by: AI Assistant <ai@rudderstack.com>
1 parent 4f0a72a commit d27b0f3

File tree

5 files changed

+397
-119
lines changed

5 files changed

+397
-119
lines changed

packages/analytics-js-plugins/__tests__/deviceModeDestinations/index.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,26 @@ describe('DeviceModeDestinations Plugin', () => {
12611261
);
12621262
});
12631263

1264+
it('should not add custom integration when it is not in the expected format', () => {
1265+
const integrationName = 'TestIntegration';
1266+
1267+
const mockIntegration = {
1268+
track: jest.fn(),
1269+
};
1270+
1271+
plugin.nativeDestinations.addCustomIntegration(
1272+
integrationName,
1273+
mockIntegration,
1274+
mockState,
1275+
mockLogger,
1276+
);
1277+
1278+
expect(mockState.nativeDestinations.activeDestinations.value).toHaveLength(0);
1279+
expect(mockLogger.error).toHaveBeenCalledWith(
1280+
`DeviceModeDestinationsPlugin:: The custom integration "${integrationName}" does not match the expected format.`,
1281+
);
1282+
});
1283+
12641284
it('should create destination with correct properties', () => {
12651285
const integrationName = 'TestIntegration';
12661286

0 commit comments

Comments
 (0)