Skip to content

Commit

Permalink
chore: added new status code tests for braze
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Oct 5, 2023
1 parent 45dfd16 commit b40add8
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/__tests__/braze.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const path = require("path");

const version = "v0";

const { FEATURE_FILTER_CODE } = require('../../src/v0/util/constant');
const transformer = require(`../../src/${version}/destinations/${integration}/transform`);
const inputDataFile = fs.readFileSync(
path.resolve(__dirname, `./data/${integration}_input.json`)
Expand Down Expand Up @@ -48,7 +49,7 @@ describe(`${name} Tests`, () => {
});
describe("Dedupenabled Router Tests", () => {
it("Payload", async () => {
const routerOutput = await transformer.processRouterDest(inputRouterData.dedupEnabledRouterRequests);
const routerOutput = await transformer.processRouterDest(inputRouterData.dedupEnabledRouterRequests, { features: { [FEATURE_FILTER_CODE]: true } });
expect(routerOutput).toEqual(expectedRouterData.dedupEnabledRouterResponse);
});
});
Expand Down
130 changes: 130 additions & 0 deletions test/__tests__/data/braze_router_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,136 @@
"anonymousId": "77e278c9-e984-4cdd-950c-cd0b61befd03",
"originalTimestamp": "2023-03-10T18:36:04.733Z"
}
},
{
"destination": {
"ID": "2N9UakqKF0D35wfzSeofIxPdL8X",
"Name": "Braze-Test",
"Config": {
"appKey": "0e5440c3-226b-45d0-91b5-c64da56cde16",
"blacklistedEvents": [],
"dataCenter": "US-03",
"enableNestedArrayOperations": false,
"enableSubscriptionGroupInGroupCall": false,
"eventFilteringOption": "disable",
"oneTrustCookieCategories": [],
"restApiKey": "dummyApiKey",
"supportDedup": true,
"trackAnonymousUser": true,
"whitelistedEvents": []
},
"Enabled": true,
"WorkspaceID": "27O0bhB6p5ehfOWeeZlOSsSDTLg",
"Transformations": [],
"IsProcessorEnabled": true,
"RevisionID": "2N9Uaf2tWq2QRmatBWQm03Rz6qX"
},
"metadata": {
"jobId": 3
},
"message": {
"anonymousId": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca",
"channel": "web",
"context": {
"app": {
"build": "1.0.0",
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "1.0.5"
},
"ip": "0.0.0.0",
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "1.0.5"
},
"locale": "en-GB",
"os": {
"name": "",
"version": ""
},
"screen": {
"density": 2
},
"traits": {
"city": "Disney",
"country": "USA",
"email": "[email protected]",
"firstName": "Mickey"
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"
},
"integrations": {
"All": true
},
"messageId": "2536eda4-d638-4c93-8014-8ffe3f083214",
"type": "identify",
"userId": "user@50"
}
},
{
"destination": {
"ID": "2N9UakqKF0D35wfzSeofIxPdL8X",
"Name": "Braze-Test",
"Config": {
"appKey": "0e5440c3-226b-45d0-91b5-c64da56cde16",
"blacklistedEvents": [],
"dataCenter": "US-03",
"enableNestedArrayOperations": false,
"enableSubscriptionGroupInGroupCall": false,
"eventFilteringOption": "disable",
"oneTrustCookieCategories": [],
"restApiKey": "dummyApiKey",
"supportDedup": true,
"trackAnonymousUser": true,
"whitelistedEvents": []
},
"Enabled": true,
"WorkspaceID": "27O0bhB6p5ehfOWeeZlOSsSDTLg",
"Transformations": [],
"IsProcessorEnabled": true,
"RevisionID": "2N9Uaf2tWq2QRmatBWQm03Rz6qX"
},
"metadata": {
"jobId": 4
},
"message": {
"anonymousId": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca",
"channel": "web",
"context": {
"app": {
"build": "1.0.0",
"name": "RudderLabs JavaScript SDK",
"namespace": "com.rudderlabs.javascript",
"version": "1.0.5"
},
"ip": "0.0.0.0",
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "1.0.5"
},
"locale": "en-GB",
"os": {
"name": "",
"version": ""
},
"screen": {
"density": 2
},
"traits": {
"city": "Disney",
"country": "USA",
"email": "[email protected]",
"firstName": "Mickey"
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36"
},
"integrations": {
"All": true
},
"messageId": "2536eda4-d638-4c93-8014-8ffe3f083214",
"type": "identify",
"userId": "user@50"
}
}
]
}
45 changes: 45 additions & 0 deletions test/__tests__/data/braze_router_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@
"is_pickup_selected": "true",
"external_id": "braze_test_user",
"custom_arr": ["1", "2", "str1"]
},
{
"city": "Disney",
"country": "USA",
"email": "[email protected]",
"external_id": "user@50",
"first_name": "Mickey"
}
],
"events": [
Expand Down Expand Up @@ -250,6 +257,9 @@
},
{
"jobId": 2
},
{
"jobId": 3
}
],
"batched": true,
Expand All @@ -276,6 +286,41 @@
"IsProcessorEnabled": true,
"RevisionID": "2N9Uaf2tWq2QRmatBWQm03Rz6qX"
}
},
{
"error": "[Braze Deduplication]: Duplicate user detected, the user is dropped",
"statTags": {
"errorCategory": "transformation"
},
"statusCode": 298,
"batched": false,
"metadata": [
{
"jobId": 4
}
],
"destination": {
"ID": "2N9UakqKF0D35wfzSeofIxPdL8X",
"Name": "Braze-Test",
"Config": {
"appKey": "0e5440c3-226b-45d0-91b5-c64da56cde16",
"blacklistedEvents": [],
"dataCenter": "US-03",
"enableNestedArrayOperations": false,
"enableSubscriptionGroupInGroupCall": false,
"eventFilteringOption": "disable",
"oneTrustCookieCategories": [],
"restApiKey": "dummyApiKey",
"supportDedup": true,
"trackAnonymousUser": true,
"whitelistedEvents": []
},
"Enabled": true,
"WorkspaceID": "27O0bhB6p5ehfOWeeZlOSsSDTLg",
"Transformations": [],
"IsProcessorEnabled": true,
"RevisionID": "2N9Uaf2tWq2QRmatBWQm03Rz6qX"
}
}
]
}
2 changes: 1 addition & 1 deletion test/__tests__/klaviyo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const integration = "klaviyo";
const name = "Klaviyo";
const version = "v0";

const { FEATURE_FILTER_CODE } = require('../../src/v0/util/constant');
const transformer = require(`../../src/${version}/destinations/${integration}/transform`);
const { FEATURE_FILTER_CODE } = require('../../src/v0/util/constant')

// Processor Test Data
const testDataFile = fs.readFileSync(
Expand Down

0 comments on commit b40add8

Please sign in to comment.