-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updated test cases according to new flow for clevertap
- Loading branch information
Showing
2 changed files
with
223 additions
and
1 deletion.
There are no files selected for viewing
219 changes: 219 additions & 0 deletions
219
test/integrations/destinations/clevertap/dataDelivery/business.ts
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 |
---|---|---|
@@ -0,0 +1,219 @@ | ||
import { ProxyV1TestData } from '../../../testTypes'; | ||
import { generateMetadata, generateProxyV1Payload } from '../../../testUtils'; | ||
|
||
const params = { | ||
destination: 'clevertap', | ||
}; | ||
const headers = { | ||
'X-CleverTap-Account-Id': '476550467', | ||
'X-CleverTap-Passcode': | ||
'fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1', | ||
'Content-Type': 'application/json', | ||
}; | ||
export const V1BusinessTestScenarion: ProxyV1TestData[] = [ | ||
{ | ||
id: 'clevertap_business_0', | ||
scenario: 'business', | ||
successCriteria: 'should return 200 status code with success message', | ||
name: 'clevertap', | ||
description: '[business]:: create an user through identify call', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
params, | ||
headers, | ||
JSON: { | ||
d: [ | ||
{ | ||
type: 'profile', | ||
profileData: { | ||
Email: '[email protected]', | ||
Name: 'James Doe', | ||
Phone: '92374162212', | ||
Gender: 'M', | ||
Employed: true, | ||
DOB: '1614775793', | ||
Education: 'Science', | ||
Married: 'Y', | ||
'Customer Type': 'Prime', | ||
graduate: true, | ||
msg_push: true, | ||
msgSms: true, | ||
msgemail: true, | ||
msgwhatsapp: false, | ||
custom_tags: '["Test_User","Interested_User","DIY_Hobby"]', | ||
custom_mappings: '{"Office":"Trastkiv","Country":"Russia"}', | ||
address: | ||
'{"city":"kolkata","country":"India","postalCode":789223,"state":"WB","street":""}', | ||
}, | ||
identity: 'anon_id', | ||
}, | ||
], | ||
}, | ||
endpoint: 'https://api.clevertap.com/1/upload/test1', | ||
}, | ||
[generateMetadata(123)], | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
response: [ | ||
{ | ||
metadata: generateMetadata(123), | ||
error: '{"status":"success","processed":1,"unprocessed":[]}', | ||
statusCode: 200, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'clevertap_business_1', | ||
scenario: 'business', | ||
successCriteria: 'should return 401 status code with error message', | ||
name: 'clevertap', | ||
description: '[business]:: event failed due to invalid credentials', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
params, | ||
headers: { | ||
'X-CleverTap-Account-Id': 'fakeId123', | ||
'X-CleverTap-Passcode': 'fakePasscode123', | ||
'Content-Type': 'application/json', | ||
}, | ||
JSON: { | ||
d: [ | ||
{ | ||
identity: 'anon-id-new', | ||
type: 'event', | ||
evtName: 'Web Page Viewed: Rudder', | ||
evtData: { | ||
title: 'Home', | ||
path: '/', | ||
}, | ||
}, | ||
], | ||
}, | ||
endpoint: 'https://api.clevertap.com/1/upload/test2', | ||
}, | ||
[generateMetadata(123)], | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 401, | ||
message: 'Request failed with status: 401', | ||
response: [ | ||
{ | ||
metadata: generateMetadata(123), | ||
error: '{"status":"fail","error":"Invalid Credentials","code":401}', | ||
statusCode: 401, | ||
}, | ||
], | ||
statTags: { | ||
destType: 'CLEVERTAP', | ||
destinationId: 'default-destinationId', | ||
errorCategory: 'network', | ||
errorType: 'aborted', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
workspaceId: 'default-workspaceId', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'clevertap_business_2', | ||
scenario: 'business', | ||
successCriteria: 'should return 401 status code with error message', | ||
name: 'clevertap', | ||
description: '[business]:: event failed due to invalid credentials', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
params, | ||
headers: { | ||
'X-CleverTap-Account-Id': '476550467', | ||
'X-CleverTap-Passcode': | ||
'fbee74a147828e2932c701d19dc1f2dcfa4ac0048be3aa3a88d427090a59dc1c0fa002f1', | ||
'Content-Type': 'application/json', | ||
}, | ||
JSON: { | ||
d: [ | ||
{ | ||
identity: 'anon-id-new', | ||
type: 'event', | ||
evtData: { | ||
title: 'Home', | ||
path: '/', | ||
}, | ||
}, | ||
], | ||
}, | ||
endpoint: 'https://api.clevertap.com/1/upload/test3', | ||
}, | ||
[generateMetadata(123)], | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 400, | ||
message: 'Request failed with status: 200', | ||
response: [ | ||
{ | ||
metadata: generateMetadata(123), | ||
error: '{"status":"fail","processed":0,"unprocessed":[]}', | ||
statusCode: 400, | ||
}, | ||
], | ||
statTags: { | ||
destType: 'CLEVERTAP', | ||
destinationId: 'default-destinationId', | ||
errorCategory: 'network', | ||
errorType: 'aborted', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
workspaceId: 'default-workspaceId', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
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