Skip to content

Commit

Permalink
chore: updated test cases according to new flow for clevertap
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSudip committed Feb 24, 2024
1 parent 41f4078 commit abbdca0
Show file tree
Hide file tree
Showing 2 changed files with 223 additions and 1 deletion.
219 changes: 219 additions & 0 deletions test/integrations/destinations/clevertap/dataDelivery/business.ts
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',
},
},
},
},
},
},
];
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const data = [
import { V1BusinessTestScenarion } from './business';
const oldV0TestCases = [
{
name: 'clevertap',
description: 'Test 0',
Expand Down Expand Up @@ -228,3 +229,5 @@ export const data = [
},
},
];

export const data = [...oldV0TestCases, ...V1BusinessTestScenarion];

0 comments on commit abbdca0

Please sign in to comment.