-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added test cases for processor
- Loading branch information
1 parent
bf506ea
commit ee1b055
Showing
15 changed files
with
809 additions
and
21 deletions.
There are no files selected for viewing
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
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
14 changes: 14 additions & 0 deletions
14
src/cdk/v2/destinations/ninetailed/data/identifyMapping.json
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,14 @@ | ||
[ | ||
{ | ||
"sourceKeys": "traits", | ||
"sourceFromGenericMap": true, | ||
"required": true, | ||
"destKey": "traits" | ||
}, | ||
{ | ||
"sourceKeys": "userIdOnly", | ||
"sourceFromGenericMap": true, | ||
"required": true, | ||
"destKey": "userId" | ||
} | ||
] |
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,7 @@ | ||
[ | ||
{ | ||
"sourceKeys": "properties", | ||
"required": true, | ||
"destKey": "properties" | ||
} | ||
] |
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,12 @@ | ||
[ | ||
{ | ||
"sourceKeys": "properties", | ||
"required": true, | ||
"destKey": "properties" | ||
}, | ||
{ | ||
"sourceKeys": "event", | ||
"required": true, | ||
"destKey": "event" | ||
} | ||
] |
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
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
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
39 changes: 39 additions & 0 deletions
39
test/integrations/destinations/ninetailed/processor/commonConfig.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,39 @@ | ||
export const destination = { | ||
ID: 'random_id', | ||
Name: 'ninetailed', | ||
DestinationDefinition: { | ||
Config: { | ||
cdkV2Enabled: true, | ||
}, | ||
}, | ||
Config: { | ||
organisationId: 'dummyOrganisationId', | ||
environment: 'main', | ||
}, | ||
}; | ||
|
||
export const metadata = { | ||
destinationId: 'dummyDestId', | ||
}; | ||
// export const endpoint = 'https://track.linksynergy.com/ep'; | ||
export const commonOutputHeaders = { | ||
accept: 'application/json', | ||
'content-type': 'application/json', | ||
}; | ||
export const commonProperties = { | ||
segment: 'SampleSegment', | ||
shipcountry: 'USA', | ||
shipped: '20240129_1500', | ||
sitename: 'SampleSiteName', | ||
storeId: '12345', | ||
storecat: 'Electronics', | ||
}; | ||
export const traits = { | ||
email: '[email protected]', | ||
firstname: 'John', | ||
lastname: 'Doe', | ||
phone: '+1(123)456-7890', | ||
gender: 'Male', | ||
birthday: '1980-01-02', | ||
city: 'San Francisco', | ||
}; |
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,5 @@ | ||
import { validationFailures } from './validation'; | ||
import { track } from './track'; | ||
import { page } from './page'; | ||
import { identify } from './identify'; | ||
export const data = [...identify, ...page, ...track, ...validationFailures]; |
160 changes: 160 additions & 0 deletions
160
test/integrations/destinations/ninetailed/processor/identify.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,160 @@ | ||
import { destination, traits, context, metadata } from './commonConfig'; | ||
import { transformResultBuilder } from '../../../testUtils'; | ||
export const identify = [ | ||
{ | ||
id: 'ninetailed-test-identify-success-1', | ||
name: 'ninetailed', | ||
description: 'identify call with all mappings available', | ||
scenario: 'Framework+Buisness', | ||
successCriteria: 'Response should contain all the mappings and status code should be 200', | ||
feature: 'processor', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: [ | ||
{ | ||
destination, | ||
message: { | ||
|
||
type: 'identify', | ||
context, | ||
userId: 'sajal12', | ||
channel: 'mobile', | ||
messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', | ||
traits: traits, | ||
anonymousId: '9c6bd77ea9da3e68', | ||
integrations: { | ||
All: true, | ||
}, | ||
originalTimestamp: '2021-01-25T15:32:56.409Z', | ||
}, | ||
metadata, | ||
}, | ||
], | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: [ | ||
{ | ||
metadata: { | ||
destinationId: 'dummyDestId', | ||
}, | ||
output: transformResultBuilder({ | ||
method: 'POST', | ||
JSON: { | ||
context: { | ||
app: { | ||
name: 'RudderLabs JavaScript SDK', | ||
version: '1.0.0', | ||
}, | ||
campaign: { | ||
name: 'campign_123', | ||
source: 'social marketing', | ||
medium: 'facebook', | ||
term: '1 year', | ||
}, | ||
library: { | ||
name: 'RudderstackSDK', | ||
version: 'Ruddderstack SDK version', | ||
}, | ||
locale: 'en-US', | ||
page: { | ||
path: '/signup', | ||
referrer: 'https://rudderstack.medium.com/', | ||
search: '?type=freetrial', | ||
url: 'https://app.rudderstack.com/signup?type=freetrial', | ||
}, | ||
userAgent: | ||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36', | ||
location: { | ||
coordinates: { | ||
latitude: 40.7128, | ||
longitude: -74.006, | ||
}, | ||
city: 'San Francisco', | ||
postalCode: '94107', | ||
region: 'CA', | ||
regionCode: 'CA', | ||
country: ' United States', | ||
countryCode: 'United States of America', | ||
continent: 'North America', | ||
timezone: 'America/Los_Angeles', | ||
}, | ||
}, | ||
type: 'identify', | ||
channel: 'mobile', | ||
userId: 'sajal12', | ||
messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', | ||
traits: traits, | ||
anonymousId: '9c6bd77ea9da3e68', | ||
originalTimestamp: '2021-01-25T15:32:56.409Z', | ||
}, | ||
userId: '', | ||
}), | ||
statusCode: 200, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'ninetailed-test-identify-failure-1', | ||
name: 'ninetailed', | ||
description: 'identify call with no userId available', | ||
scenario: 'Framework', | ||
successCriteria: | ||
'Error should be thrown for required field userId not present and status code should be 200', | ||
feature: 'processor', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: [ | ||
{ | ||
destination, | ||
message: { | ||
context, | ||
type: 'identify', | ||
channel: 'mobile', | ||
messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', | ||
traits: traits, | ||
anonymousId: '9c6bd77ea9da3e68', | ||
integrations: { | ||
All: true, | ||
}, | ||
originalTimestamp: '2021-01-25T15:32:56.409Z', | ||
}, | ||
metadata, | ||
}, | ||
], | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: [ | ||
{ | ||
error: | ||
'Missing required value from "userIdOnly": Workflow: procWorkflow, Step: preparePayload, ChildStep: undefined, OriginalError: Missing required value from "userIdOnly"', | ||
metadata: { | ||
destinationId: 'dummyDestId', | ||
}, | ||
statTags: { | ||
destType: 'NINETAILED', | ||
destinationId: 'dummyDestId', | ||
errorCategory: 'dataValidation', | ||
errorType: 'instrumentation', | ||
feature: 'processor', | ||
implementation: 'cdkV2', | ||
module: 'destination', | ||
}, | ||
statusCode: 400, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.