diff --git a/test/integrations/destinations/linkedin_ads/dataDelivery/business.ts b/test/integrations/destinations/linkedin_ads/dataDelivery/business.ts index 72ac5b59af..ff4fa4455f 100644 --- a/test/integrations/destinations/linkedin_ads/dataDelivery/business.ts +++ b/test/integrations/destinations/linkedin_ads/dataDelivery/business.ts @@ -67,6 +67,18 @@ export const statTags = { module: 'destination', }; +export const metadata = { + jobId: 1, + attemptNum: 1, + userId: 'default-userId', + destinationId: 'default-destinationId', + workspaceId: 'default-workspaceId', + sourceId: 'default-sourceId', + secret: { + accessToken: 'default-accessToken', + }, + dontBatch: false, +}; export const headerBlockWithCorrectAccessToken = { Authorization: 'Bearer default-accessToken', 'Content-Type': 'application/json', @@ -116,30 +128,10 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ error: '{"message":"Incorrect conversions information provided. Conversion\'s method should be CONVERSIONS_API, indices [0] (0-indexed)","status":400}', statusCode: 400, - metadata: { - jobId: 1, - attemptNum: 1, - userId: 'default-userId', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - sourceId: 'default-sourceId', - secret: { - accessToken: 'default-accessToken', - }, - dontBatch: false, - }, + metadata, }, ], - statTags: { - errorCategory: 'network', - errorType: 'aborted', - destType: 'LINKEDIN_ADS', - module: 'destination', - implementation: 'native', - feature: 'dataDelivery', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - }, + statTags, status: 400, }, }, @@ -147,7 +139,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ }, }, { - id: 'linkedin_ads_v1_scenario_1', + id: 'linkedin_ads_v1_scenario_2', name: 'linkedin_ads', description: 'Event fails due to wrong format payload sent to linkedin', successCriteria: 'Should return 400 with appropriate reason of failure', @@ -184,18 +176,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ error: '/conversionValue/amount :: field is required but not found and has no default value', statusCode: 400, - metadata: { - jobId: 1, - attemptNum: 1, - userId: 'default-userId', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - sourceId: 'default-sourceId', - secret: { - accessToken: 'default-accessToken', - }, - dontBatch: false, - }, + metadata, }, ], status: 422, diff --git a/test/integrations/destinations/linkedin_ads/dataDelivery/oauth.ts b/test/integrations/destinations/linkedin_ads/dataDelivery/oauth.ts index c6ae5d9589..fd62e64c67 100644 --- a/test/integrations/destinations/linkedin_ads/dataDelivery/oauth.ts +++ b/test/integrations/destinations/linkedin_ads/dataDelivery/oauth.ts @@ -33,6 +33,19 @@ export const statTags = { module: 'destination', }; +export const metadata = { + jobId: 1, + attemptNum: 1, + userId: 'default-userId', + destinationId: 'default-destinationId', + workspaceId: 'default-workspaceId', + sourceId: 'default-sourceId', + secret: { + accessToken: 'default-accessToken', + }, + dontBatch: false, +}; + export const headerBlockWithCorrectAccessToken = { Authorization: 'Bearer default-accessToken', 'Content-Type': 'application/json', @@ -59,7 +72,7 @@ const commonRequestParametersWithRevokedAccess = { export const oauthScenariosV1: ProxyV1TestData[] = [ { - id: 'linkedin_ads_v1_scenario_1', + id: 'linkedin_ads_v1_oauth_scenario_1', name: 'linkedin_ads', description: 'app event fails due to revoked access token error', successCriteria: 'Should return 500 with revoked access token error', @@ -86,30 +99,10 @@ export const oauthScenariosV1: ProxyV1TestData[] = [ error: '{"status":401,"serviceErrorCode":65601,"code":"REVOKED_ACCESS_TOKEN","message":"The token used in the request has been revoked by the user"}', statusCode: 500, - metadata: { - jobId: 1, - attemptNum: 1, - userId: 'default-userId', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - sourceId: 'default-sourceId', - secret: { - accessToken: 'revokedToken', - }, - dontBatch: false, - }, + metadata: { ...metadata, secret: { accessToken: 'revokedToken' } }, }, ], - statTags: { - errorCategory: 'network', - errorType: 'retryable', - destType: 'LINKEDIN_ADS', - module: 'destination', - implementation: 'native', - feature: 'dataDelivery', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - }, + statTags: { ...statTags, errorType: 'retryable' }, authErrorCategory: 'REFRESH_TOKEN', message: 'LinkedIn Conversion API: Error transformer proxy v1 during LinkedIn Conversion API response transformation. Invalid or expired access token. Retrying', @@ -120,7 +113,7 @@ export const oauthScenariosV1: ProxyV1TestData[] = [ }, }, { - id: 'linkedin_ads_v1_scenario_1', + id: 'linkedin_ads_v1_oauth_scenario_2', name: 'linkedin_ads', description: 'app event fails due to invalid access token error', successCriteria: 'Should return 500 with invalid access token error', @@ -147,30 +140,10 @@ export const oauthScenariosV1: ProxyV1TestData[] = [ error: '{"status":401,"serviceErrorCode":65600,"code":"INVALID_ACCESS_TOKEN","message":"Invalid access token"}', statusCode: 500, - metadata: { - jobId: 1, - attemptNum: 1, - userId: 'default-userId', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - sourceId: 'default-sourceId', - secret: { - accessToken: 'invalidToken', - }, - dontBatch: false, - }, + metadata: { ...metadata, secret: { accessToken: 'invalidToken' } }, }, ], - statTags: { - errorCategory: 'network', - errorType: 'retryable', - destType: 'LINKEDIN_ADS', - module: 'destination', - implementation: 'native', - feature: 'dataDelivery', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - }, + statTags: { ...statTags, errorType: 'retryable' }, authErrorCategory: 'REFRESH_TOKEN', message: 'LinkedIn Conversion API: Error transformer proxy v1 during LinkedIn Conversion API response transformation. Invalid or expired access token. Retrying', @@ -181,7 +154,7 @@ export const oauthScenariosV1: ProxyV1TestData[] = [ }, }, { - id: 'linkedin_ads_v1_scenario_1', + id: 'linkedin_ads_v1_oauth_scenario_3', name: 'linkedin_ads', description: 'success case', successCriteria: 'Should return 200 response', diff --git a/test/integrations/destinations/linkedin_ads/processor/configLevelFeaturesTestData.ts b/test/integrations/destinations/linkedin_ads/processor/configLevelFeaturesTestData.ts index 9f18408ea9..31a08ca0e0 100644 --- a/test/integrations/destinations/linkedin_ads/processor/configLevelFeaturesTestData.ts +++ b/test/integrations/destinations/linkedin_ads/processor/configLevelFeaturesTestData.ts @@ -61,7 +61,7 @@ const commonTimestamp = new Date('2023-10-14'); export const configLevelFeaturesTestData: ProcessorTestData[] = [ { - id: 'linkedin_ads-track-test-1', + id: 'linkedin_ads-config-test-1', name: 'linkedin_ads', description: 'Track call : hashData is set to false and no deduplication key is provided', scenario: 'Business', @@ -139,7 +139,7 @@ export const configLevelFeaturesTestData: ProcessorTestData[] = [ }, }, { - id: 'linkedin_ads-track-test-1', + id: 'linkedin_ads-config-test-2', name: 'linkedin_ads', description: 'Track call : hashData is set to true and deduplication key is provided', scenario: 'Business', diff --git a/test/integrations/destinations/linkedin_ads/processor/trackTestData.ts b/test/integrations/destinations/linkedin_ads/processor/trackTestData.ts index 4bfe268f72..78bdf33c7b 100644 --- a/test/integrations/destinations/linkedin_ads/processor/trackTestData.ts +++ b/test/integrations/destinations/linkedin_ads/processor/trackTestData.ts @@ -637,7 +637,7 @@ export const trackTestData: ProcessorTestData[] = [ }, }, { - id: 'linkedin_ads-track-test-5', + id: 'linkedin_ads-track-test-7', name: 'linkedin_ads', description: 'Track call : track event containing product array where not all products contains price field', diff --git a/test/integrations/destinations/linkedin_ads/processor/validationTestData.ts b/test/integrations/destinations/linkedin_ads/processor/validationTestData.ts index e53dae6fdc..5b5cc8535c 100644 --- a/test/integrations/destinations/linkedin_ads/processor/validationTestData.ts +++ b/test/integrations/destinations/linkedin_ads/processor/validationTestData.ts @@ -1,9 +1,4 @@ -import { - generateMetadata, - generateTrackPayload, - overrideDestination, - transformResultBuilder, -} from '../../../testUtils'; +import { generateMetadata, generateTrackPayload, overrideDestination } from '../../../testUtils'; import { Destination } from '../../../../../src/types'; import { ProcessorTestData } from '../../../testTypes'; @@ -85,7 +80,7 @@ const olderTimestamp = new Date('2023-07-13'); export const validationTestData: ProcessorTestData[] = [ { - id: 'linkedin_ads-track-test-1', + id: 'linkedin_ads-validation-test-1', name: 'linkedin_ads', description: 'Track call : event is older than 90 days', scenario: 'Business', @@ -137,7 +132,7 @@ export const validationTestData: ProcessorTestData[] = [ }, }, { - id: 'linkedin_ads-track-test-2', + id: 'linkedin_ads-validation-test-2', name: 'linkedin_ads', description: 'Track call : event not mapped to conversion rule in UI', scenario: 'Business', @@ -234,7 +229,7 @@ export const validationTestData: ProcessorTestData[] = [ }, }, { - id: 'linkedin_ads-track-test-4', + id: 'linkedin_ads-validation-test-4', name: 'linkedin_ads', description: 'Track call : properties without product array and no price', scenario: 'Business', @@ -272,16 +267,7 @@ export const validationTestData: ProcessorTestData[] = [ error: '[LinkedIn Conversion API]: Cannot map price for event random event. Aborting: Workflow: procWorkflow, Step: commonFields, ChildStep: undefined, OriginalError: [LinkedIn Conversion API]: Cannot map price for event random event. Aborting', metadata: generateMetadata(1), - statTags: { - destinationId: 'default-destinationId', - errorCategory: 'dataValidation', - errorType: 'instrumentation', - implementation: 'cdkV2', - destType: 'LINKEDIN_ADS', - module: 'destination', - feature: 'processor', - workspaceId: 'default-workspaceId', - }, + statTags: commonStats, statusCode: 400, }, ], @@ -289,7 +275,7 @@ export const validationTestData: ProcessorTestData[] = [ }, }, { - id: 'linkedin_ads-track-test-5', + id: 'linkedin_ads-validation-test-5', name: 'linkedin_ads', description: 'Track call : properties without product array and no price', scenario: 'Business',