From 78129d4580474e20414be74f5a2489b9443bc2eb Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Fri, 1 Mar 2024 19:27:42 +0530 Subject: [PATCH] chore: updated tests --- .../destinations/fb/dataDelivery/business.ts | 128 ++++++------------ .../destinations/fb/dataDelivery/other.ts | 19 +-- 2 files changed, 48 insertions(+), 99 deletions(-) diff --git a/test/integrations/destinations/fb/dataDelivery/business.ts b/test/integrations/destinations/fb/dataDelivery/business.ts index 91a994a550..156dc26572 100644 --- a/test/integrations/destinations/fb/dataDelivery/business.ts +++ b/test/integrations/destinations/fb/dataDelivery/business.ts @@ -2,6 +2,44 @@ import { generateMetadata, generateProxyV1Payload } from '../../../testUtils'; import { ProxyV1TestData } from '../../../testTypes'; import { VERSION } from '../../../../../src/v0/destinations/fb/config'; +export const testData1 = { + event: 'CUSTOM_APP_EVENTS', + advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', + 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', + 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', + 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', + extinfo: + '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', + app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', +}; + +export const testData2 = { + extinfo: '["a2","","","","8.1.0","Redmi 6","","","Banglalink",0,100,"50.00",0,0,0,""]', + custom_events: + '[{"_logTime":1567333011693,"_eventName":"Viewed Screen","fb_description":"Main.1233"}]', + 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', + advertiser_tracking_enabled: '0', + application_tracking_enabled: '0', + event: 'CUSTOM_APP_EVENTS', +}; + +export const statTags = { + destType: 'FB', + errorCategory: 'network', + destinationId: 'default-destinationId', + workspaceId: 'default-workspaceId', + errorType: 'aborted', + feature: 'dataDelivery', + implementation: 'native', + module: 'destination', +}; + export const testScenariosForV1API: ProxyV1TestData[] = [ { id: 'fb_v1_scenario_1', @@ -22,22 +60,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ params: { destination: 'fb', }, - FORM: { - event: 'CUSTOM_APP_EVENTS', - advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', - 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', - 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', - 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', - 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', - 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', - extinfo: - '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', - app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', - custom_events: - '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', - advertiser_tracking_enabled: '0', - application_tracking_enabled: '0', - }, + FORM: testData1, }), method: 'POST', }, @@ -50,15 +73,10 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ status: 400, message: 'Invalid OAuth 2.0 access token', statTags: { - destType: 'FB', + ...statTags, errorCategory: 'dataValidation', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', errorType: 'configuration', meta: 'accessTokenExpired', - feature: 'dataDelivery', - implementation: 'native', - module: 'destination', }, response: [ { @@ -91,22 +109,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ params: { destination: 'fb', }, - FORM: { - event: 'CUSTOM_APP_EVENTS', - advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', - 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', - 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', - 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', - 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', - 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', - extinfo: - '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', - app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', - custom_events: - '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', - advertiser_tracking_enabled: '0', - application_tracking_enabled: '0', - }, + FORM: testData1, }), method: 'POST', }, @@ -149,22 +152,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ params: { destination: 'fb', }, - FORM: { - event: 'CUSTOM_APP_EVENTS', - advertiser_id: 'df16bffa-5c3d-4fbb-9bce-3bab098129a7R', - 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', - 'ud[fn]': '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08', - 'ud[ge]': '62c66a7a5dd70c3146618063c344e531e6d4b59e379808443ce962b3abd63c5a', - 'ud[ln]': '3547cb112ac4489af2310c0626cdba6f3097a2ad5a3b42ddd3b59c76c7a079a3', - 'ud[ph]': '588211a01b10feacbf7988d97a06e86c18af5259a7f457fd8759b7f7409a7d1f', - extinfo: - '["a2","","","","8.1.0","Redmi 6","","","Banglalink",640,480,"1.23",0,0,0,"Europe/Berlin"]', - app_user_id: 'c82cbdff-e5be-4009-ac78-cdeea09ab4b1', - custom_events: - '[{"_logTime":1567333011693,"_eventName":"spin_result","_valueToSum":400,"fb_currency":"GBP","additional_bet_index":0,"battle_id":"N/A","bet_amount":9,"bet_level":1,"bet_multiplier":1,"coin_balance":9466052,"current_module_name":"CasinoGameModule","days_in_game":0,"extra_param":"N/A","fb_profile":"0","featureGameType":"N/A","game_fps":30,"game_id":"fireEagleBase","game_name":"FireEagleSlots","gem_balance":0,"graphicsQuality":"HD","idfa":"2bf99787-33d2-4ae2-a76a-c49672f97252","internetReachability":"ReachableViaLocalAreaNetwork","isLowEndDevice":"False","is_auto_spin":"False","is_turbo":"False","isf":"False","ishighroller":"False","jackpot_win_amount":90,"jackpot_win_type":"Silver","level":6,"lifetime_gem_balance":0,"no_of_spin":1,"player_total_battles":0,"player_total_shields":0,"start_date":"2019-08-01","total_payments":0,"tournament_id":"T1561970819","userId":"c82cbdff-e5be-4009-ac78-cdeea09ab4b1","versionSessionCount":2,"win_amount":0,"fb_content_id":["123","345","567"]}]', - advertiser_tracking_enabled: '0', - application_tracking_enabled: '0', - }, + FORM: testData1, }), method: 'POST', }, @@ -176,16 +164,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ output: { status: 400, message: 'Event Timestamp Too Old', - statTags: { - destType: 'FB', - errorCategory: 'network', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - errorType: 'aborted', - feature: 'dataDelivery', - implementation: 'native', - module: 'destination', - }, + statTags, response: [ { error: 'Event Timestamp Too Old', @@ -217,15 +196,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ params: { destination: 'fb', }, - FORM: { - extinfo: '["a2","","","","8.1.0","Redmi 6","","","Banglalink",0,100,"50.00",0,0,0,""]', - custom_events: - '[{"_logTime":1567333011693,"_eventName":"Viewed Screen","fb_description":"Main.1233"}]', - 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', - advertiser_tracking_enabled: '0', - application_tracking_enabled: '0', - event: 'CUSTOM_APP_EVENTS', - }, + FORM: testData2, }), method: 'POST', }, @@ -238,16 +209,7 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ status: 400, message: "Object with ID 'PIXEL_ID' / 'DATASET_ID' / 'AUDIENCE_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation", - statTags: { - destType: 'FB', - errorCategory: 'network', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', - errorType: 'aborted', - feature: 'dataDelivery', - implementation: 'native', - module: 'destination', - }, + statTags, response: [ { error: diff --git a/test/integrations/destinations/fb/dataDelivery/other.ts b/test/integrations/destinations/fb/dataDelivery/other.ts index 28363d5a92..9ac3f14fb5 100644 --- a/test/integrations/destinations/fb/dataDelivery/other.ts +++ b/test/integrations/destinations/fb/dataDelivery/other.ts @@ -1,6 +1,7 @@ import { generateMetadata, generateProxyV1Payload } from '../../../testUtils'; import { ProxyV1TestData } from '../../../testTypes'; import { VERSION } from '../../../../../src/v0/destinations/fb/config'; +import { testData2 as testData, statTags } from './business'; export const otherScenariosV1: ProxyV1TestData[] = [ { @@ -19,15 +20,7 @@ export const otherScenariosV1: ProxyV1TestData[] = [ params: { destination: 'fb', }, - FORM: { - extinfo: '["a2","","","","8.1.0","Redmi 6","","","Banglalink",0,100,"50.00",0,0,0,""]', - custom_events: - '[{"_logTime":1567333011693,"_eventName":"Viewed Screen","fb_description":"Main.1233"}]', - 'ud[em]': '48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', - advertiser_tracking_enabled: '0', - application_tracking_enabled: '0', - event: 'CUSTOM_APP_EVENTS', - }, + FORM: testData, }), method: 'POST', }, @@ -40,14 +33,8 @@ export const otherScenariosV1: ProxyV1TestData[] = [ status: 429, message: 'API User Too Many Calls', statTags: { - destType: 'FB', - errorCategory: 'network', - destinationId: 'default-destinationId', - workspaceId: 'default-workspaceId', + ...statTags, errorType: 'throttled', - feature: 'dataDelivery', - implementation: 'native', - module: 'destination', }, response: [ {