From 0a6b8d3b0937e3827c1c626c6f397971d6bf63ef Mon Sep 17 00:00:00 2001 From: ItsSudip Date: Sat, 16 Dec 2023 17:50:24 +0530 Subject: [PATCH] chore: added component test cases for desitnations --- test/__mocks__/axios.js | 43 - test/__mocks__/data/monday/response.json | 212 -- test/__mocks__/data/profitwell/response.json | 34 - test/__mocks__/klaviyo.mock.js | 39 - test/__mocks__/kustomer.mock.js | 142 -- test/__mocks__/mailchimp.mock.js | 49 - test/__mocks__/monday.mock.js | 32 - test/__mocks__/profitwell.mock.js | 16 - test/__mocks__/sendinblue.mock.js | 23 - test/__tests__/data/klaviyo.json | 1970 -------------- test/__tests__/data/klaviyo_router.json | 599 ----- test/__tests__/data/kustomer_input.json | 851 ------- test/__tests__/data/kustomer_output.json | 602 ----- .../__tests__/data/kustomer_router_input.json | 183 -- .../data/kustomer_router_output.json | 184 -- .../__tests__/data/mailchimp_batch_input.json | 225 -- .../data/mailchimp_batch_output.json | 100 - test/__tests__/data/mailchimp_input.json | 1299 ---------- test/__tests__/data/mailchimp_output.json | 498 ---- .../data/mailchimp_router_input.json | 347 --- .../data/mailchimp_router_output.json | 238 -- test/__tests__/data/monday.json | 1023 -------- test/__tests__/data/monday_router_input.json | 111 - test/__tests__/data/monday_router_output.json | 84 - test/__tests__/data/profitwell_input.json | 719 ------ test/__tests__/data/profitwell_output.json | 166 -- .../data/profitwell_router_input.json | 45 - .../data/profitwell_router_output.json | 44 - test/__tests__/data/sendinblue.json | 1196 --------- .../data/sendinblue_router_input.json | 187 -- .../data/sendinblue_router_output.json | 196 -- test/__tests__/klaviyo.test.js | 47 - test/__tests__/kustomer.test.js | 49 - test/__tests__/mailchimp.test.js | 67 - test/__tests__/monday.test.js | 46 - test/__tests__/profitwell.test.js | 62 - test/__tests__/sendinblue.test.js | 47 - .../destinations/klaviyo/router/data.ts | 845 +++--- .../destinations/kustomer/network.ts | 423 +++ .../destinations/kustomer/processor/data.ts | 1901 ++++++++++++++ .../destinations/kustomer/router/data.ts | 393 +++ .../destinations/mailchimp/network.ts | 80 + .../destinations/mailchimp/processor/data.ts | 2259 +++++++++++++++++ .../destinations/mailchimp/router/data.ts | 977 +++++++ .../destinations/monday/network.ts | 242 ++ .../destinations/monday/processor/data.ts | 1399 ++++++++++ .../destinations/monday/router/data.ts | 228 ++ .../destinations/profitwell/network.ts | 94 + .../destinations/profitwell/processor/data.ts | 1241 +++++++++ .../destinations/profitwell/router/data.ts | 113 + .../destinations/sendinblue/network.ts | 92 + .../destinations/sendinblue/processor/data.ts | 1722 +++++++++++++ .../destinations/sendinblue/router/data.ts | 410 +++ 53 files changed, 12023 insertions(+), 12171 deletions(-) delete mode 100644 test/__mocks__/data/monday/response.json delete mode 100644 test/__mocks__/data/profitwell/response.json delete mode 100644 test/__mocks__/klaviyo.mock.js delete mode 100644 test/__mocks__/kustomer.mock.js delete mode 100644 test/__mocks__/mailchimp.mock.js delete mode 100644 test/__mocks__/monday.mock.js delete mode 100644 test/__mocks__/profitwell.mock.js delete mode 100644 test/__mocks__/sendinblue.mock.js delete mode 100644 test/__tests__/data/klaviyo.json delete mode 100644 test/__tests__/data/klaviyo_router.json delete mode 100644 test/__tests__/data/kustomer_input.json delete mode 100644 test/__tests__/data/kustomer_output.json delete mode 100644 test/__tests__/data/kustomer_router_input.json delete mode 100644 test/__tests__/data/kustomer_router_output.json delete mode 100644 test/__tests__/data/mailchimp_batch_input.json delete mode 100644 test/__tests__/data/mailchimp_batch_output.json delete mode 100644 test/__tests__/data/mailchimp_input.json delete mode 100644 test/__tests__/data/mailchimp_output.json delete mode 100644 test/__tests__/data/mailchimp_router_input.json delete mode 100644 test/__tests__/data/mailchimp_router_output.json delete mode 100644 test/__tests__/data/monday.json delete mode 100644 test/__tests__/data/monday_router_input.json delete mode 100644 test/__tests__/data/monday_router_output.json delete mode 100644 test/__tests__/data/profitwell_input.json delete mode 100644 test/__tests__/data/profitwell_output.json delete mode 100644 test/__tests__/data/profitwell_router_input.json delete mode 100644 test/__tests__/data/profitwell_router_output.json delete mode 100644 test/__tests__/data/sendinblue.json delete mode 100644 test/__tests__/data/sendinblue_router_input.json delete mode 100644 test/__tests__/data/sendinblue_router_output.json delete mode 100644 test/__tests__/klaviyo.test.js delete mode 100644 test/__tests__/kustomer.test.js delete mode 100644 test/__tests__/mailchimp.test.js delete mode 100644 test/__tests__/monday.test.js delete mode 100644 test/__tests__/profitwell.test.js delete mode 100644 test/__tests__/sendinblue.test.js create mode 100644 test/integrations/destinations/kustomer/network.ts create mode 100644 test/integrations/destinations/kustomer/processor/data.ts create mode 100644 test/integrations/destinations/kustomer/router/data.ts create mode 100644 test/integrations/destinations/mailchimp/network.ts create mode 100644 test/integrations/destinations/mailchimp/processor/data.ts create mode 100644 test/integrations/destinations/mailchimp/router/data.ts create mode 100644 test/integrations/destinations/monday/network.ts create mode 100644 test/integrations/destinations/monday/processor/data.ts create mode 100644 test/integrations/destinations/monday/router/data.ts create mode 100644 test/integrations/destinations/profitwell/network.ts create mode 100644 test/integrations/destinations/profitwell/processor/data.ts create mode 100644 test/integrations/destinations/profitwell/router/data.ts create mode 100644 test/integrations/destinations/sendinblue/network.ts create mode 100644 test/integrations/destinations/sendinblue/processor/data.ts create mode 100644 test/integrations/destinations/sendinblue/router/data.ts diff --git a/test/__mocks__/axios.js b/test/__mocks__/axios.js index 7ec3692cdb..fc4190c32e 100644 --- a/test/__mocks__/axios.js +++ b/test/__mocks__/axios.js @@ -3,19 +3,12 @@ /// ///////////////////////////////////////////////////////////////////////////// const axios = jest.genMockFromModule("axios"); const acPostRequestHandler = require("./active_campaign.mock"); -const { - klaviyoPostRequestHandler, - klaviyoGetRequestHandler -} = require("./klaviyo.mock"); -const kustomerGetRequestHandler = require("./kustomer.mock"); const trengoGetRequestHandler = require("./trengo.mock"); -const mailchimpGetRequestHandler = require("./mailchimp.mock"); const yahooDspPostRequestHandler = require("./yahoo_dsp.mock"); const { hsGetRequestHandler, hsPostRequestHandler } = require("./hs.mock"); const { delightedGetRequestHandler } = require("./delighted.mock"); const { dripPostRequestHandler } = require("./drip.mock"); -const profitwellGetRequestHandler = require("./profitwell.mock"); const cannyPostRequestHandler = require("./canny.mock"); const custifyPostRequestHandler = require("./custify.mock"); const { @@ -29,13 +22,11 @@ const { freshmarketerPostRequestHandler, freshmarketerGetRequestHandler } = require("./freshmarketer.mock"); -const { mondayPostRequestHandler } = require("./monday.mock"); const { freshsalesGetRequestHandler, freshsalesPostRequestHandler } = require("./freshsales.mock"); const { sendgridGetRequestHandler } = require("./sendgrid.mock"); -const { sendinblueGetRequestHandler } = require("./sendinblue.mock"); const { courierGetRequestHandler } = require("./courier.mock"); const { brazePostRequestHandler } = require("./braze.mock"); @@ -45,10 +36,8 @@ const urlDirectoryMap = { "salesforce.com": "salesforce", "mktorest.com": "marketo", "active.campaigns.rudder.com": "active_campaigns", - "api.profitwell.com": "profitwell", "ruddertest2.mautic.net": "mautic", "api.sendgrid.com": "sendgrid", - "api.sendinblue.com": "sendinblue", "api.criteo.com": "criteo_audience", "api.courier.com": "courier", }; @@ -83,33 +72,17 @@ function getData(url) { function get(url, options) { const mockData = getData(url); - if (url.includes("https://api.kustomerapp.com") || url.includes("https://api.prod2.kustomerapp.com")) { - return new Promise((resolve, reject) => { - resolve(kustomerGetRequestHandler(url)); - }); - } if (url.includes("https://app.trengo.com")) { return new Promise((resolve, reject) => { resolve(trengoGetRequestHandler(url)); }); } - if (url.includes("api.mailchimp.com")) { - return new Promise((resolve, reject) => { - resolve(mailchimpGetRequestHandler(url)); - }); - } - if (url.includes("https://a.klaviyo.com/api/v2/people/search")) { - return klaviyoGetRequestHandler(getParamEncodedUrl(url, options)); - } if (url.includes("https://api.hubapi.com")) { return hsGetRequestHandler(url, mockData); } if (url.includes("https://api.delighted.com/v1/people.json")) { return delightedGetRequestHandler(options); } - if (url.includes("https://api.profitwell.com")) { - return profitwellGetRequestHandler(url, mockData); - } if ( url.includes( "https://api.getdrip.com/v2/1809802/subscribers/identified_user@gmail.com" @@ -146,9 +119,6 @@ function get(url, options) { if (url.includes("https://api.sendgrid.com/v3/marketing/field_definitions")) { return Promise.resolve(sendgridGetRequestHandler(url)); } - if (url.includes("https://api.sendinblue.com/v3/contacts/")) { - return Promise.resolve(sendinblueGetRequestHandler(url, mockData)); - } if (url.includes("https://api.courier.com")) { return Promise.resolve(courierGetRequestHandler(url, mockData)); } @@ -177,11 +147,6 @@ function post(url, payload) { resolve(brazePostRequestHandler(url, payload)); }); } - if (url.includes("https://a.klaviyo.com")) { - return new Promise((resolve, reject) => { - resolve(klaviyoPostRequestHandler(url, payload)); - }); - } if (url.includes("https://api.aptrinsic.com")) { return new Promise(resolve => { resolve({ status: 201 }); @@ -226,14 +191,6 @@ function post(url, payload) { resolve(freshsalesPostRequestHandler(url)); }); } - if ( - url.includes("https://api.monday.com") && - payload.query.includes("query") - ) { - return new Promise((resolve, reject) => { - resolve(mondayPostRequestHandler(payload)); - }); - } if (url.includes("https://api.custify.com")) { return Promise.resolve(custifyPostRequestHandler(url)); } diff --git a/test/__mocks__/data/monday/response.json b/test/__mocks__/data/monday/response.json deleted file mode 100644 index a6445f18ac..0000000000 --- a/test/__mocks__/data/monday/response.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "339283933": { - "data": { - "boards": [ - { - "name": "Planning", - "columns": [ - { - "id": "name", - "title": "Name", - "type": "name", - "description": null, - "settings_str": "{}" - }, - { - "id": "subitems", - "title": "Subitems", - "type": "subtasks", - "description": null, - "settings_str": "{\"allowMultipleItems\":true,\"itemTypeName\":\"column.subtasks.title\",\"displayType\":\"BOARD_INLINE\",\"boardIds\":[3160974974]}" - }, - { - "id": "person", - "title": "Person", - "type": "multiple-person", - "description": null, - "settings_str": "{}" - }, - { - "id": "status", - "title": "Status", - "type": "color", - "description": null, - "settings_str": "{\"labels\":{\"0\":\"Working on it\",\"1\":\"Done\",\"2\":\"Stuck\"},\"labels_positions_v2\":{\"0\":0,\"1\":2,\"2\":1,\"5\":3},\"labels_colors\":{\"0\":{\"color\":\"#fdab3d\",\"border\":\"#E99729\",\"var_name\":\"orange\"},\"1\":{\"color\":\"#00c875\",\"border\":\"#00B461\",\"var_name\":\"green-shadow\"},\"2\":{\"color\":\"#e2445c\",\"border\":\"#CE3048\",\"var_name\":\"red-shadow\"}}}" - }, - { - "id": "date4", - "title": "Date", - "type": "date", - "description": null, - "settings_str": "{}" - }, - { - "id": "checkbox", - "title": "Checkbox", - "type": "boolean", - "description": null, - "settings_str": "{}" - }, - { - "id": "connect_boards", - "title": "Connect boards", - "type": "board-relation", - "description": null, - "settings_str": "{\"allowCreateReflectionColumn\":false}" - }, - { - "id": "status_1", - "title": "Other", - "type": "color", - "description": null, - "settings_str": "{\"labels\":{\"0\":\"Working on it\",\"1\":\"Done\",\"2\":\"Stuck\"},\"labels_colors\":{\"0\":{\"color\":\"#fdab3d\",\"border\":\"#E99729\",\"var_name\":\"orange\"},\"1\":{\"color\":\"#00c875\",\"border\":\"#00B461\",\"var_name\":\"green-shadow\"},\"2\":{\"color\":\"#e2445c\",\"border\":\"#CE3048\",\"var_name\":\"red-shadow\"}}}" - }, - { - "id": "date_1", - "title": "Date 1", - "type": "date", - "description": null, - "settings_str": "{\"hide_footer\":false}" - }, - { - "id": "status_12", - "title": "new status", - "type": "color", - "description": null, - "settings_str": "{\"labels\":{\"0\":\"Working on it\",\"1\":\"Done\",\"2\":\"Stuck\"},\"labels_colors\":{\"0\":{\"color\":\"#fdab3d\",\"border\":\"#E99729\",\"var_name\":\"orange\"},\"1\":{\"color\":\"#00c875\",\"border\":\"#00B461\",\"var_name\":\"green-shadow\"},\"2\":{\"color\":\"#e2445c\",\"border\":\"#CE3048\",\"var_name\":\"red-shadow\"}}}" - }, - { - "id": "numbers", - "title": "Numbers", - "type": "numeric", - "description": null, - "settings_str": "{}" - }, - { - "id": "text", - "title": "Name", - "type": "text", - "description": null, - "settings_str": "{}" - }, - { - "id": "country", - "title": "Country", - "type": "country", - "description": null, - "settings_str": "{}" - }, - { - "id": "dropdown", - "title": "Dropdown", - "type": "dropdown", - "description": null, - "settings_str": "{\"hide_footer\":false,\"labels\":[{\"id\":1,\"name\":\"dropdown\"},{\"id\":2,\"name\":\"dropup\"}]}" - }, - { - "id": "email", - "title": "Email", - "type": "email", - "description": null, - "settings_str": "{}" - }, - { - "id": "location", - "title": "Location", - "type": "location", - "description": null, - "settings_str": "{}" - }, - { - "id": "phone", - "title": "Phone", - "type": "phone", - "description": null, - "settings_str": "{}" - }, - { - "id": "rating", - "title": "Rating", - "type": "rating", - "description": null, - "settings_str": "{}" - }, - { - "id": "timeline", - "title": "Timeline", - "type": "timerange", - "description": null, - "settings_str": "{\"hide_footer\":false}" - }, - { - "id": "dependent_on", - "title": "Dependent On", - "type": "dependency", - "description": "Choose the item your task will be dependent on. If the “dependent on” item’s date is changing, the other dates will adjust automatically", - "settings_str": "{\"boardIds\":[3142482015],\"dependencyNewInfra\":true,\"allowMultipleItems\":true}" - }, - { - "id": "long_text", - "title": "Long Text", - "type": "long-text", - "description": null, - "settings_str": "{}" - }, - { - "id": "link", - "title": "Link", - "type": "link", - "description": null, - "settings_str": "{}" - }, - { - "id": "tags", - "title": "Tags", - "type": "tag", - "description": null, - "settings_str": "{\"hide_footer\":false}" - }, - { - "id": "label", - "title": "Label", - "type": "color", - "description": "", - "settings_str": "{\"done_colors\":[1],\"labels\":{\"3\":\"Label 2\",\"105\":\"Label 1\",\"156\":\"Label 3\"},\"labels_positions_v2\":{\"3\":1,\"5\":3,\"105\":0,\"156\":2},\"labels_colors\":{\"3\":{\"color\":\"#0086c0\",\"border\":\"#3DB0DF\",\"var_name\":\"blue-links\"},\"105\":{\"color\":\"#9AADBD\",\"border\":\"#9AADBD\",\"var_name\":\"winter\"},\"156\":{\"color\":\"#9D99B9\",\"border\":\"#9D99B9\",\"var_name\":\"purple_gray\"}}}" - }, - { - "id": "world_clock", - "title": "World Clock", - "type": "timezone", - "description": null, - "settings_str": "{}" - }, - { - "id": "week", - "title": "Week", - "type": "week", - "description": null, - "settings_str": "{}" - } - ], - "groups": [ - { - "id": "topics", - "title": "This month" - }, - { - "id": "group_title", - "title": "Next month" - } - ] - } - ] - }, - "account_id": 13215538 - }, - "339283934": { - "data": { - "boards": [] - }, - "account_id": 16260452 - } -} diff --git a/test/__mocks__/data/profitwell/response.json b/test/__mocks__/data/profitwell/response.json deleted file mode 100644 index 21c4f240bc..0000000000 --- a/test/__mocks__/data/profitwell/response.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "https://api.profitwell.com/v2/users/pwu_Oea7HXV3bnTP/": [ - { - "user_id": "pwu_Oea7HXV3bnTP", - "subscription_id": "pws_FecTCEyo17rV", - "user_alias": "spiderman_1a", - "subscription_alias": "spiderman_sub_1a", - "email": "spiderman@profitwell.com", - "plan_id": "web_plan", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": 5000, - "effective_date": 1514764800, - "meta": {} - } - ], - "https://api.profitwell.com/v2/users/spiderman_1a/": [ - { - "user_id": "pwu_Oea7HXV3bnTP", - "subscription_id": "pws_FecTCEyo17rV", - "user_alias": "spiderman_1a", - "subscription_alias": "spiderman_sub_1a", - "email": "spiderman@profitwell.com", - "plan_id": "web_plan", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": 5000, - "effective_date": 1514764800, - "meta": {} - } - ] -} diff --git a/test/__mocks__/klaviyo.mock.js b/test/__mocks__/klaviyo.mock.js deleted file mode 100644 index 020387d1f2..0000000000 --- a/test/__mocks__/klaviyo.mock.js +++ /dev/null @@ -1,39 +0,0 @@ -const klaviyoPostRequestHandler = (url, payload) => { - switch (url) { - case 'https://a.klaviyo.com/api/v2/list/XUepkK/subscribe': - //resolve with status 200 - return { data: payload, status: 200 }; - case 'https://a.klaviyo.com/api/v2/list/XUepkK/members': - //resolve with status 200 - return { data: payload, status: 200 }; - case 'https://a.klaviyo.com/api/profiles': - if (payload.data.attributes.email === "test3@rudderstack.com") { - return { - status: 409, - data: { - } - }; - } - return { - status: 201, - data: { - data: { - id: '01GW3PHVY0MTCDGS0A1612HARX', - attributes: {} - }, - } - }; - default: - return new Promise((resolve, reject) => { - if (payload) { - resolve({ data: payload }); - } else { - resolve({ error: 'Request failed' }); - } - }); - } -}; - -module.exports = { - klaviyoPostRequestHandler, -}; diff --git a/test/__mocks__/kustomer.mock.js b/test/__mocks__/kustomer.mock.js deleted file mode 100644 index 0a1187595d..0000000000 --- a/test/__mocks__/kustomer.mock.js +++ /dev/null @@ -1,142 +0,0 @@ -const storedPayload = { - data: { - type: "customer", - id: "58210c3db0f09110006b7953", - attributes: { - name: "AnnoD", - displayName: "AnnoD", - displayColor: "yellow", - displayIcon: "flower", - externalId: "annodD", - externalIds: [ - { - externalId: "annodD", - verified: true, - id: null - } - ], - sharedExternalIds: [], - signedUpAt: null, - avatarUrl: null, - username: null, - emails: [ - { - email: "annod@kustomer.com", - verified: true, - type: "home", - id: null - } - ], - sharedEmails: [ - { - email: "annod@kustomer.com", - verified: false, - type: "home", - id: null - } - ], - phones: [], - sharedPhones: [], - socials: [], - sharedSocials: [], - urls: [], - locations: [], - activeUsers: [], - watchers: [], - recentLocation: { - updatedAt: "2016-11-07T23:22:01.746Z" - }, - locale: null, - timeZone: null, - birthdayAt: null, - gender: null, - presence: "offline", - createdAt: "2016-11-07T23:20:29.080Z", - updatedAt: "2016-11-09T04:47:07.036Z", - modifiedAt: "2016-11-09T04:47:07.036Z", - lastSeenAt: "2016-11-07T23:23:51.582Z", - lastActivityAt: "2016-11-09T04:47:07.036Z", - lastCustomerActivityAt: "2016-11-07T23:23:51.582Z", - lastMessageIn: { - sentAt: "2016-11-07T23:22:02.281Z", - sentiment: null - }, - lastConversation: { - id: "58210c99b0f09110006b7969", - sentiment: { - confidence: 0.649023, - polarity: 1 - }, - tags: [] - }, - conversationCounts: { - all: 3, - snoozed: 0, - open: 2, - done: 1 - }, - preview: { - previewAt: "2016-11-07T23:23:26.039Z", - type: "message_out", - text: "dfsd fsdsfdsfdsf", - subject: "Hi, do you guys have an XXL hoodie" - }, - tags: [], - sentiment: { - polarity: 1, - confidence: 0.649023 - }, - progressiveStatus: "open", - verified: true, - rev: 37 - }, - relationships: { - org: { - links: { - self: "/v1/orgs/57f29863a1dbf61100e6aa92" - }, - data: { - type: "org", - id: "57f29863a1dbf61100e6aa92" - } - }, - messages: { - links: { - self: "/v1/customers/58210c3db0f09110006b7953/messages" - } - }, - modifiedBy: { - links: { - self: "/v1/users/58190b991f2932100010d683" - }, - data: { - type: "user", - id: "58190b991f2932100010d683" - } - } - }, - links: { - self: "/v1/customers/58210c3db0f09110006b7953" - } - } -}; - -const kustomerGetRequestHandler = url => { - switch (url) { - case "https://api.kustomerapp.com/v1/customers/externalId=annodD": - //resolve with status 200 - return { data: storedPayload, status: 200 }; - case "https://api.kustomerapp.com/v1/customers/externalId=58210c3db0f09110006b7953": - //resolve with status 200 - return { data: storedPayload, status: 200 }; - case "https://api.prod2.kustomerapp.com/v1/customers/externalId=58210c3db0f09110006b7953": - //resolve with status 200 - return { data: storedPayload, status: 200 }; - default: - return new Promise((resolve, reject) => { - resolve({ error: "Request failed", status: 404 }); - }); - } -}; - -module.exports = kustomerGetRequestHandler; diff --git a/test/__mocks__/mailchimp.mock.js b/test/__mocks__/mailchimp.mock.js deleted file mode 100644 index e52814c822..0000000000 --- a/test/__mocks__/mailchimp.mock.js +++ /dev/null @@ -1,49 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const urlDirectoryMap = { - "api.mailchimp.com": "mailchimp" -}; - -const getData = url => { - let directory = ""; - Object.keys(urlDirectoryMap).forEach(key => { - if (url.includes(key)) { - directory = urlDirectoryMap[key]; - } - }); - if (directory) { - const dataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${directory}/response.json`) - ); - const data = JSON.parse(dataFile); - return data[url]; - } - return {}; -}; - -const mailchimpGetRequestHandler = url => { - const mockData = getData(url); - if (mockData) { - if ( - url === - "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab" - ) { - return { data: mockData, status: 200 }; - } else if (url === "https://usXX.api.mailchimp.com/3.0/lists/aud111") { - return { data: mockData, status: 200 }; - } else if (url === "https://usXX.api.mailchimp.com/3.0/lists/aud112") { - return { data: mockData, status: 200 }; - } else { - return new Promise((resolve, reject) => { - reject({ error: "Request failed", status: mockData.status }); - }); - } - } else { - return new Promise((resolve, reject) => { - reject({ error: "Request failed", status: 404 }); - }); - } -}; - -module.exports = mailchimpGetRequestHandler; diff --git a/test/__mocks__/monday.mock.js b/test/__mocks__/monday.mock.js deleted file mode 100644 index 0a9eb627be..0000000000 --- a/test/__mocks__/monday.mock.js +++ /dev/null @@ -1,32 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const getData = payload => { - const dataFile = fs.readFileSync( - path.resolve(__dirname, `./data/monday/response.json`) - ); - const data = JSON.parse(dataFile); - const boardId = payload.query.substring(21,30); - return data[boardId]; -}; - -const mondayPostRequestHandler = payload => { - const mockData = getData(payload); - if (mockData) { - return { data: mockData, status: 200 }; - } - return new Promise((resolve, reject) => { - reject({ - response: { - data: { - error: "Not found", - status: 404 - } - } - }); - }); -}; - -module.exports = { - mondayPostRequestHandler -}; diff --git a/test/__mocks__/profitwell.mock.js b/test/__mocks__/profitwell.mock.js deleted file mode 100644 index 5dce8fbe75..0000000000 --- a/test/__mocks__/profitwell.mock.js +++ /dev/null @@ -1,16 +0,0 @@ -const profitwellGetRequestHandler = (url, payload) => { - if (url === "https://api.profitwell.com/v2/users/pwu_Oea7HXV3bnTP/") - return Promise.resolve({ data: payload, status: 200 }); - else if (url === "https://api.profitwell.com/v2/users/spiderman_1a/") { - return Promise.resolve({ data: payload, status: 200 }); - } - return Promise.reject({ - response: { - message: "Request failed with status code 404", - status: 404, - statusText: "Not Found" - } - }); -}; - -module.exports = profitwellGetRequestHandler; diff --git a/test/__mocks__/sendinblue.mock.js b/test/__mocks__/sendinblue.mock.js deleted file mode 100644 index 53b3e84677..0000000000 --- a/test/__mocks__/sendinblue.mock.js +++ /dev/null @@ -1,23 +0,0 @@ -const sendinblueGetRequestHandler = (url, mockData) => { - if ( - url === - "https://api.sendinblue.com/v3/contacts/gordon_pittman%40example.com" || - url === "https://api.sendinblue.com/v3/contacts/42" - ) { - return { data: mockData, status: 200 }; - } - - return Promise.reject({ - response: { - data: { - code: "document_not_found", - message: "Contact does not exist" - }, - status: 404 - } - }); -}; - -module.exports = { - sendinblueGetRequestHandler -}; diff --git a/test/__tests__/data/klaviyo.json b/test/__tests__/data/klaviyo.json deleted file mode 100644 index 623aa78cc4..0000000000 --- a/test/__tests__/data/klaviyo.json +++ /dev/null @@ -1,1970 +0,0 @@ -[ - { - "description": "Profile updating call and subscribe user (old transformer)", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": [ - { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "user@1", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Content-Type": "application/json", - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] - }, - { - "description": "Identify call for with flattenProperties enabled (old transformer)", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "flattenProperties": true - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "friend": { - "names": { - "first": "Alice", - "last": "Smith" - }, - "age": 25 - }, - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": [ - { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "user@1", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "friend.age": 25, - "friend.names.first": "Alice", - "friend.names.last": "Smith", - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Content-Type": "application/json", - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] - }, - { - "description": "Profile updation call and subcribe user", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test3@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Failed to create user due to {}" - } - }, - { - "description": "Profile updation call listId is not provided for subscribing the user", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "subscribe": false, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "user@1", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Identify call with enforceEmailAsPrimary enabled from UI", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "enforceEmailAsPrimary": true - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": [ - { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya", - "_id": "user@1" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Content-Type": "application/json", - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] - }, - { - "description": "Identify call without user custom Properties", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "enforceEmailAsPrimary": false - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": [ - { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "external_id": "user@1", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Content-Type": "application/json", - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] - }, - { - "description": "Identify call without email and phone & enforceEmailAsPrimary enabled from UI", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "enforceEmailAsPrimary": true - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@1", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "userId": "user@1", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "None of email and phone are present in the payload" - } - }, - { - "description": "Screen event call", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "screen", - "event": "TestEven001", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "TestEven001" - }, - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22" - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track event call with flatten properties enabled", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "flattenProperties": true - } - }, - "message": { - "type": "track", - "event": "TestEven001", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68", - "plan_details": { - "plan_type": "gold", - "duration": "3 months" - } - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "vicePresdentInfo": { - "PreviouslVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["AaronBurr", "GeorgeClinton"] - } - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "TestEven001" - }, - "properties": { - "vicePresdentInfo.PreviouslVicePresident": true, - "vicePresdentInfo.VicePresidents": ["AaronBurr", "GeorgeClinton"], - "vicePresdentInfo.YearElected": 1801 - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22", - "plan_details.plan_type": "gold", - "plan_details.duration": "3 months" - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track event call", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "track", - "event": "TestEven002", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "name": "Test", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68", - "description": "Sample description" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"], - "revenue": 3000 - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "TestEven002" - }, - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22", - "name": "Test", - "description": "Sample description" - }, - "value": 3000 - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track event call, with make email or phone as primary identifier toggle on", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "enforceEmailAsPrimary": true - } - }, - "message": { - "type": "track", - "event": "TestEven001", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "TestEven001" - }, - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "age": "22", - "_id": "sajal12" - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track event call, without email and phone & with (make email or phone as primary identifier) toggle on", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "enforceEmailAsPrimary": true - } - }, - "message": { - "type": "track", - "event": "TestEven001", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "anonymousId": "9c6bd77ea9da3e68" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "PreviouslyVicePresident": true, - "YearElected": 1801, - "VicePresidents": ["Aaron Burr", "George Clinton"] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "error": "None of email and phone are present in the payload" - } - }, - { - "description": "group call", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": ["email"] - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - }, - "output": [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Content-Type": "application/json", - "Accept": "application/json", - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 678 900" - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ] - }, - { - "description": "group call without groupId", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - }, - "output": { - "error": "groupId is a required field for group events" - } - }, - { - "description": "[Error]: Check for unsupported message type", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "userId": "user123", - "type": "random", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - }, - "output": { - "error": "Event type random is not supported" - } - }, - { - "description": "Track call with Ecom events (Viewed Product)", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "track", - "event": "product viewed", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "name": "Test", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68", - "description": "Sample description" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "name": "test product", - "product_id": "1114", - "sku": "WINNIePuh12", - "image_url": "http://www.example.com/path/to/product/image.png", - "url": "http://www.example.com/path/to/product", - "brand": "Not for Kids", - "price": 9.9, - "categories": ["Fiction", "Children"] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "Viewed Product" - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22", - "name": "Test", - "description": "Sample description" - }, - "properties": { - "ProductName": "test product", - "ProductID": "1114", - "SKU": "WINNIePuh12", - "ImageURL": "http://www.example.com/path/to/product/image.png", - "URL": "http://www.example.com/path/to/product", - "Brand": "Not for Kids", - "Price": 9.9, - "Categories": ["Fiction", "Children"] - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track call with Ecom events (Checkout Started) with enabled flattenProperties", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey", - "flattenProperties": true - } - }, - "message": { - "type": "track", - "event": "checkout started", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "name": "Test", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68", - "description": "Sample description" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "order_id": "1234", - "affiliation": "Apple Store", - "value": 20, - "revenue": 15.0, - "shipping": 4, - "tax": 1, - "discount": 1.5, - "coupon": "ImagePro", - "currency": "USD", - "products": [ - { - "product_id": "123", - "sku": "G-32", - "name": "Monopoly", - "price": 14, - "quantity": 1, - "category": "Games", - "url": "https://www.website.com/product/path", - "image_url": "https://www.website.com/product/path.jpg" - }, - { - "product_id": "345", - "sku": "F-32", - "name": "UNO", - "price": 3.45, - "quantity": 2, - "category": "Games" - } - ] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "Started Checkout" - }, - "properties": { - "$event_id": "1234", - "$value": 20, - "items[0].ProductID": "123", - "items[0].SKU": "G-32", - "items[0].ProductName": "Monopoly", - "items[0].Quantity": 1, - "items[0].ItemPrice": 14, - "items[0].ProductURL": "https://www.website.com/product/path", - "items[0].ImageURL": "https://www.website.com/product/path.jpg", - "items[1].ProductID": "345", - "items[1].SKU": "F-32", - "items[1].ProductName": "UNO", - "items[1].Quantity": 2, - "items[1].ItemPrice": 3.45 - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22", - "name": "Test", - "description": "Sample description" - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track call with Ecom events (Added to Cart) with properties.products", - "input": { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "message": { - "type": "track", - "event": "product added", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "sajal12", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "traits": { - "id": "user@1", - "age": "22", - "name": "Test", - "email": "test@rudderstack.com", - "phone": "9112340375", - "anonymousId": "9c6bd77ea9da3e68", - "description": "Sample description" - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "order_id": "1234", - "value": 12.12, - "categories": ["Fiction3", "Children3"], - "checkout_url": "http://www.heythere.com", - "item_names": ["book1", "book2"], - "products": [ - { - "product_id": "b1pid", - "sku": "123x", - "name": "book1", - "url": "heyther.com", - "price": 12.0 - }, - { - "product_id": "b2pid", - "sku": "123x", - "name": "book2", - "url": "heyther2.com", - "price": 14.0 - } - ] - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/events", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "event", - "attributes": { - "metric": { - "name": "Added to Cart" - }, - "profile": { - "$email": "test@rudderstack.com", - "$phone_number": "9112340375", - "$id": "sajal12", - "age": "22", - "name": "Test", - "description": "Sample description" - }, - "properties": { - "$value": 12.12, - "AddedItemCategories": ["Fiction3", "Children3"], - "ItemNames": ["book1", "book2"], - "CheckoutURL": "http://www.heythere.com", - "items": [ - { - "ProductID": "b1pid", - "SKU": "123x", - "ProductName": "book1", - "ItemPrice": 12, - "ProductURL": "heyther.com" - }, - { - "ProductID": "b2pid", - "SKU": "123x", - "ProductName": "book2", - "ItemPrice": 14, - "ProductURL": "heyther2.com" - } - ] - } - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - } -] diff --git a/test/__tests__/data/klaviyo_router.json b/test/__tests__/data/klaviyo_router.json deleted file mode 100644 index 7fae2ad90e..0000000000 --- a/test/__tests__/data/klaviyo_router.json +++ /dev/null @@ -1,599 +0,0 @@ -[ - { - "description": "Router tests", - "input": [ - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 1 - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "test", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "Testc", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 2 - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "test", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "test", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 3 - }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": ["email"] - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 4 - }, - "message": { - "userId": "user123", - "type": "random", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 5 - }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - } - ], - "newTransformerOutput": [ - { - "batchedRequest": [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 678 900" - }, - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - "metadata": [ - { - "jobId": 3 - }, - { - "jobId": 2 - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "test", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "error": "{\"id\":\"01GW3PHVY0MTCDGS0A1612HARX\",\"attributes\":{}}", - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 299, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "error": "Event type random is not supported", - "metadata": [ - { - "jobId": 4 - } - ], - "batched": false, - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "statusCode": 400, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "error": "groupId is a required field for group events", - "metadata": [ - { - "jobId": 5 - } - ], - "batched": false, - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "statusCode": 400, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - } - ], - "oldTransformerOutput": [ - { - "batchedRequest": [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 678 900" - }, - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "test", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - "metadata": [ - { - "jobId": 3 - }, - { - "jobId": 2 - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "test", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "metadata": [ - { - "jobId": 4 - } - ], - "batched": false, - "statusCode": 400, - "error": "Event type random is not supported", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "metadata": [ - { - "jobId": 5 - } - ], - "batched": false, - "statusCode": 400, - "error": "groupId is a required field for group events", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - } - ] - } -] diff --git a/test/__tests__/data/kustomer_input.json b/test/__tests__/data/kustomer_input.json deleted file mode 100644 index c711c2499c..0000000000 --- a/test/__tests__/data/kustomer_input.json +++ /dev/null @@ -1,851 +0,0 @@ -[ - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "Testc", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "name": "Test Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12345578900", - "birthday": "2005-01-01T23:28:56.782Z", - "userId": "Testc", - "address": { - "street": "24 Dovers Lane", - "city": "Miami", - "state": "Florida", - "postalCode": "1890001" - }, - "userName": "Testc47", - "company": "Rudderstack", - "createdAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatar": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "website": "www.mattertoast873.com", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ] - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "userId": "58210c3db0f09110006b7953", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "name": "Ano Domeni", - "phone": "+12345578000", - "birthday": "2005-01-01T23:28:56.782Z" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "screen", - "event": "Test-Event-Screen", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "Testc", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "hasAccount": "true", - "YearSelectedNum": 1801, - "originalServing": "2021-01-25T15:32:56.409Z" - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "name": "Cart-Viewed", - "type": "page", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "traits": { - "userId": "userid", - "profession": "Student", - "anonymousId": "d80b66d5-b33d-412d-866f-r4fft5841af" - }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "category": "Cart", - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "url": "http://morkey.in", - "name": "Cart Viewed", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.195Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "page", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "traits": { - "userId": "userid", - "profession": "Student", - "anonymousId": "d80b66d5-b33d-412d-866f-r4fft5841af" - }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "category": "Cart", - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com", - "kustomerTrackingId": "829131sjad", - "kustomerSessionId": "hsad522" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.195Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "track", - "event": "Tracking-Weekender", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "YearServicedNum": 211, - "region": "strapis", - "kustomerTrackingId": "sahetwiac", - "kustomerSessionId": "63nsa22" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "locale": "en-US", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.195Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "track", - "event": "Tracking-Weekender2", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "YearServicedNum": 211, - "reg_8-821x": false, - "kustomer_tracking_id": "sahetwiac", - "kustomer_session_id": "63nsa22" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "locale": "en-US", - "originalTimestamp": "2021-01-03T17:02:53.195Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericPage": true - } - }, - "message": { - "type": "page", - "name": "Unfinished page", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "locale": "en-US", - "originalTimestamp": "2021-01-03T17:02:53.195Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericScreen": true - } - }, - "message": { - "type": "screen", - "event": "Test-Event-Screen", - "sentAt": "2021-01-25T16:12:02.048Z", - "userId": "Testc", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "hasAccount": "true", - "YearSelectedNum": 1801, - "originalServing": "2021-01-25T15:32:56.409Z" - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-25T15:32:56.409Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "Testc", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12345578900", - "birthday": "2005-01-01T23:28:56.782Z", - "userId": "Testc", - "address": { - "street": "24 Dovers Lane", - "city": "Miami", - "state": "Florida", - "postalCode": "1890001" - }, - "userName": "Testc47", - "company": "Rudderstack", - "createdAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatar": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "website": "www.mattertoast873.com", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ] - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "Testc", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "birthday": "2005-01-01T23:28:56.782Z", - "userId": "Testc", - "address": "test address string", - "userName": "Testc47", - "company": "Rudderstack", - "createdAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatar": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "website": "www.mattertoast873.com", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ] - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey" - } - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "Testc", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "birthday": "2005-01-01T23:28:56.782Z", - "userId": "Testc", - "address": "test address string", - "userName": "Testc47", - "company": "Rudderstack", - "createdAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatar": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "website": "www.mattertoast873.com", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ] - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0", - "externalId": [ - { - "type": "kustomerId", - "id": "abcd1234" - } - ] - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericScreen": true - } - }, - "message": { - "type": "screen", - "event": "Test-Event-Screen", - "userId": "utsabc", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)", - "sessionId": "hsad522" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "hasAccount": "true", - "YearSelectedNum": 1801 - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2023-01-10T15:32:56.409Z" - } - }, - { - "destination": { - "Config": { - "apiKey": "dummyAPIkey", - "baseEndpoint": "https://api.prod2.kustomerapp.com", - "apiKey": "dummyApiKey", - "genericScreen": true - } - }, - "message": { - "type": "screen", - "event": "Test-Event-Screen", - "userId": "Testc", - "channel": "mobile", - "context": { - "os": { - "name": "Android", - "version": "10" - }, - "app": { - "name": "KlaviyoTest", - "build": "1", - "version": "1.0", - "namespace": "com.rudderstack.android.rudderstack.sampleAndroidApp" - }, - "device": { - "id": "9c6bd77ea9da3e68", - "name": "raphaelin", - "type": "android", - "model": "Redmi K20 Pro", - "manufacturer": "Xiaomi" - }, - "locale": "en-IN", - "screen": { - "width": 1080, - "height": 2210, - "density": 440 - }, - "library": { - "name": "com.rudderstack.android.sdk.core", - "version": "1.0.2" - }, - "network": { - "wifi": true, - "carrier": "airtel", - "cellular": true, - "bluetooth": false - }, - "timezone": "Asia/Kolkata", - "userAgent": "Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)", - "sessionId": "hsad522" - }, - "rudderId": "b7b24f86-f7bf-46d8-b2b4-ccafc080239c", - "messageId": "1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce", - "properties": { - "hasAccount": "true", - "YearSelectedNum": 1801 - }, - "anonymousId": "9c6bd77ea9da3e68", - "integrations": { - "All": true - }, - "originalTimestamp": "2023-01-10T15:32:56.409Z" - } - } -] diff --git a/test/__tests__/data/kustomer_output.json b/test/__tests__/data/kustomer_output.json deleted file mode 100644 index 0a0876d29a..0000000000 --- a/test/__tests__/data/kustomer_output.json +++ /dev/null @@ -1,602 +0,0 @@ -[ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/customers", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "Test Rudderlabs", - "externalId": "Testc", - "username": "Testc47", - "company": "Rudderstack", - "signedUpAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatarUrl": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "locale": "en-US", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ], - "birthdayAt": "2005-01-01T23:28:56.782Z", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "urls": [ - { - "url": "www.mattertoast873.com" - } - ], - "locations": [ - { - "type": "home", - "address": "24 Dovers Lane Miami Florida 1890001" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://api.kustomerapp.com/v1/customers/58210c3db0f09110006b7953?replace=false", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "Ano Domeni", - "externalId": "58210c3db0f09110006b7953", - "locale": "en-US", - "birthdayAt": "2005-01-01T23:28:56.782Z", - "phones": [ - { - "type": "home", - "phone": "+12345578000" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "Testc" - }, - "event": { - "name": "Screen-Viewed-Test-Event-Screen", - "meta": { - "hasAccount": "true", - "YearSelectedNum": 1801, - "originalServing": "2021-01-25T15:32:56.409Z" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Web-Page-Viewed-Cart-Viewed", - "meta": { - "url": "http://morkey.in", - "name": "Cart Viewed", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Web-Page-Viewed", - "sessionId": "hsad522", - "trackingId": "829131sjad", - "meta": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Tracking-Weekender", - "sessionId": "63nsa22", - "trackingId": "sahetwiac", - "meta": { - "YearServicedNum": 211, - "region": "strapis" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "FORM": {}, - "JSON": { - "event": { - "meta": { - "YearServicedNum": 211, - "reg_8-821x": false - }, - "name": "Tracking-Weekender2", - "sessionId": "63nsa22", - "trackingId": "sahetwiac" - }, - "identity": { - "externalId": "user@doe" - } - }, - "XML": {}, - "JSON_ARRAY": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Web-Page-Viewed", - "meta": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "category": "Cart", - "referrer": "morkey", - "domain": "morkey.com" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "Testc" - }, - "event": { - "name": "Screen-Viewed", - "meta": { - "hasAccount": "true", - "YearSelectedNum": 1801, - "originalServing": "2021-01-25T15:32:56.409Z" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/customers", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "Test Rudderlabs", - "externalId": "Testc", - "username": "Testc47", - "company": "Rudderstack", - "signedUpAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatarUrl": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "locale": "en-US", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ], - "birthdayAt": "2005-01-01T23:28:56.782Z", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "urls": [ - { - "url": "www.mattertoast873.com" - } - ], - "locations": [ - { - "type": "home", - "address": "24 Dovers Lane Miami Florida 1890001" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/customers", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "Test Rudderlabs", - "externalId": "Testc", - "username": "Testc47", - "company": "Rudderstack", - "signedUpAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatarUrl": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "locale": "en-US", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ], - "birthdayAt": "2005-01-01T23:28:56.782Z", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "urls": [ - { - "url": "www.mattertoast873.com" - } - ], - "locations": [ - { - "type": "home", - "address": "test address string" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://api.kustomerapp.com/v1/customers/abcd1234?replace=false", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "Test Rudderlabs", - "externalId": "Testc", - "username": "Testc47", - "company": "Rudderstack", - "signedUpAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatarUrl": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "locale": "en-US", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@Testc", - "url": "http://twitter.com/Testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "Testc", - "url": "http://facebook.com/Testc" - } - ], - "birthdayAt": "2005-01-01T23:28:56.782Z", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "urls": [ - { - "url": "www.mattertoast873.com" - } - ], - "locations": [ - { - "type": "home", - "address": "test address string" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "utsabc" - }, - "event": { - "name": "Screen-Viewed", - "sessionId": "hsad522", - "meta": { - "hasAccount": "true", - "YearSelectedNum": 1801 - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.prod2.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "Testc" - }, - "event": { - "name": "Screen-Viewed", - "sessionId": "hsad522", - "meta": { - "hasAccount": "true", - "YearSelectedNum": 1801 - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - } -] diff --git a/test/__tests__/data/kustomer_router_input.json b/test/__tests__/data/kustomer_router_input.json deleted file mode 100644 index 0e4c88aa20..0000000000 --- a/test/__tests__/data/kustomer_router_input.json +++ /dev/null @@ -1,183 +0,0 @@ -[ - { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "testc", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "name": "test Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12345578900", - "birthday": "2005-01-01T23:28:56.782Z", - "userId": "testc", - "address": { - "street": "24 Dovers Lane", - "city": "Miami", - "state": "Florida", - "postalCode": "1890001" - }, - "userName": "testc47", - "company": "Rudderstack", - "createdAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatar": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "website": "www.mattertoast873.com", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@testc", - "url": "http://twitter.com/testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "testc", - "url": "http://facebook.com/testc" - } - ] - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "metadata": { - "jobId": 1 - }, - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - }, - { - "message": { - "type": "track", - "event": "Tracking-Weekender", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "YearServicedNum": 211, - "region": "strapis", - "kustomerTrackingId": "sahetwiac", - "kustomerSessionId": "63nsa22" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "locale": "en-US", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.195Z" - }, - "metadata": { - "jobId": 2 - }, - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - }, - { - "message": { - "type": "track", - "event": "Tracking-Weekender", - "sentAt": "2021-01-03T17:02:53.197Z", - "userId": "user@doe", - "channel": "web", - "context": { - "os": { "name": "", "version": "" }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "http://morkey.in", - "path": "/cart", - "title": "miphone", - "search": "MI", - "referrer": "morkey" - }, - "locale": "en-US", - "screen": { "density": 2 }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.1.11" }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "15129730-eb00-4db7-8db2-799566ccb2ef", - "properties": { - "YearServicedNum": 211, - "region": "strapis", - "kustomerTrackingId": "sahetwiac", - "kustomerSessionId": "63nsa22" - }, - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "locale": "en-US", - "integrations": { "All": true }, - "originalTimestamp": "2021-01-03T17:02:53.195Z" - }, - "metadata": { - "jobId": 2 - }, - "destination": { - "Config": { - "baseEndpoint": "https://api.prod2.kustomerapp.com", - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - } -] diff --git a/test/__tests__/data/kustomer_router_output.json b/test/__tests__/data/kustomer_router_output.json deleted file mode 100644 index 0d3470f74a..0000000000 --- a/test/__tests__/data/kustomer_router_output.json +++ /dev/null @@ -1,184 +0,0 @@ -[ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/customers", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "name": "test Rudderlabs", - "externalId": "testc", - "username": "testc47", - "company": "Rudderstack", - "signedUpAt": "2015-04-17T12:37:42.146Z", - "lastActivityAt": "2016-04-17T12:37:42.146Z", - "lastCustomerActivityAt": "2017-04-17T12:37:42.146Z", - "lastSeenAt": "2017-04-17T12:37:42.146Z", - "avatarUrl": "https://homepages.cae.wisc.edu/~ece533/images/boat.png", - "gender": "m", - "tags": ["happy", "satisfied"], - "locale": "en-US", - "socials": [ - { - "verified": true, - "userid": "100", - "type": "twitter", - "username": "@testc", - "url": "http://twitter.com/testc" - }, - { - "verified": false, - "userid": "200", - "type": "facebook", - "username": "testc", - "url": "http://facebook.com/testc" - } - ], - "birthdayAt": "2005-01-01T23:28:56.782Z", - "emails": [ - { - "type": "home", - "email": "test@rudderstack.com" - } - ], - "phones": [ - { - "type": "home", - "phone": "+12345578900" - } - ], - "urls": [ - { - "url": "www.mattertoast873.com" - } - ], - "locations": [ - { - "type": "home", - "address": "24 Dovers Lane Miami Florida 1890001" - } - ] - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Tracking-Weekender", - "sessionId": "63nsa22", - "trackingId": "sahetwiac", - "meta": { - "YearServicedNum": 211, - "region": "strapis" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 2 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.prod2.kustomerapp.com/v1/tracking/identityEvent", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer dummyApiKey" - }, - "params": {}, - "body": { - "JSON": { - "identity": { - "externalId": "user@doe" - }, - "event": { - "name": "Tracking-Weekender", - "sessionId": "63nsa22", - "trackingId": "sahetwiac", - "meta": { - "YearServicedNum": 211, - "region": "strapis" - } - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 2 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "baseEndpoint": "https://api.prod2.kustomerapp.com", - "apiKey": "dummyApiKey", - "genericPage": false, - "genericScreen": false - } - } - } -] diff --git a/test/__tests__/data/mailchimp_batch_input.json b/test/__tests__/data/mailchimp_batch_input.json deleted file mode 100644 index ea382b1d89..0000000000 --- a/test/__tests__/data/mailchimp_batch_input.json +++ /dev/null @@ -1,225 +0,0 @@ -[ - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 2 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "mappedToDestination": true, - "externalId": [ - { - "identifierType": "email_address", - "id": "bob.dole@initech.com", - "type": "audience" - } - ], - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "traits": { - "merge_fields": { - "FIRSTNAME": "Bob" - }, - "status": "subscribed" - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 3 - }, - "message": { - "type": "identify", - "traits": { - "status": "subscribed" - }, - "userId": "emrichardson820+22822@gmail.com", - "channel": "sources", - "context": { - "sources": { - "job_id": "24c5HJxHomh6YCngEOCgjS5r1KX/Syncher", - "task_id": "vw_rs_mailchimp_mocked_hg_data", - "version": "v1.8.1", - "batch_id": "f252c69d-c40d-450e-bcd2-2cf26cb62762", - "job_run_id": "c8el40l6e87v0c4hkbl0", - "task_run_id": "c8el40l6e87v0c4hkblg" - }, - "externalId": [ - { - "id": "emrichardson820+22822@gmail.com", - "type": "MAILCHIMP-92e1f1ad2c", - "identifierType": "email_address" - } - ], - "mappedToDestination": "true" - }, - "recordId": "1", - "rudderId": "4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a", - "messageId": "b3bee036-fc26-4f6d-9867-c17f85708a82" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 4 - }, - "message": { - "type": "identify", - "traits": { - "status": "subscribed" - }, - "userId": "emrichardson820+22822@gmail.com", - "channel": "sources", - "context": { - "sources": { - "job_id": "24c5HJxHomh6YCngEOCgjS5r1KX/Syncher", - "task_id": "vw_rs_mailchimp_mocked_hg_data", - "version": "v1.8.1", - "batch_id": "f252c69d-c40d-450e-bcd2-2cf26cb62762", - "job_run_id": "c8el40l6e87v0c4hkbl0", - "task_run_id": "c8el40l6e87v0c4hkblg" - }, - "externalId": [ - { - "id": "emrichardson820+22822@gmail.com", - "type": "MAILCHIMP-92e1f1ad2c", - "identifierType": "email_address" - } - ], - "mappedToDestination": "true" - }, - "recordId": "1", - "rudderId": "4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a", - "messageId": "b3bee036-fc26-4f6d-9867-c17f85708a82" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 5 - }, - "message": { - "type": "identify", - "traits": { - "status": "subscrib" - }, - "userId": "emrichardson820+22822@gmail.com", - "channel": "sources", - "context": { - "sources": { - "job_id": "24c5HJxHomh6YCngEOCgjS5r1KX/Syncher", - "task_id": "vw_rs_mailchimp_mocked_hg_data", - "version": "v1.8.1", - "batch_id": "f252c69d-c40d-450e-bcd2-2cf26cb62762", - "job_run_id": "c8el40l6e87v0c4hkbl0", - "task_run_id": "c8el40l6e87v0c4hkblg" - }, - "externalId": [ - { - "id": "emrichardson820+22822@gmail.com", - "type": "MAILCHIMP-92e1f1ad2c", - "identifierType": "email_address" - } - ], - "mappedToDestination": "true" - }, - "recordId": "1", - "rudderId": "4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a", - "messageId": "b3bee036-fc26-4f6d-9867-c17f85708a82" - } - } -] diff --git a/test/__tests__/data/mailchimp_batch_output.json b/test/__tests__/data/mailchimp_batch_output.json deleted file mode 100644 index fac07b6a46..0000000000 --- a/test/__tests__/data/mailchimp_batch_output.json +++ /dev/null @@ -1,100 +0,0 @@ -[ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://us20.api.mailchimp.com/3.0/lists/1232yyqw22?skip_merge_validation=false&skip_duplicate_check=false", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmFwaUtleS1kdW1teUFwaUtleQ==" - }, - "params": {}, - "body": { - "JSON": { - "members": [ - { - "merge_fields": { - "FIRSTNAME": "Bob" - }, - "status": "subscribed", - "email_address": "bob.dole@initech.com" - }, - { - "status": "subscribed", - "email_address": "emrichardson820+22822@gmail.com" - }, - { - "status": "subscribed", - "email_address": "emrichardson820+22822@gmail.com" - } - ], - "update_existing": true - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 2 - }, - { - "jobId": 3 - }, - { - "jobId": 4 - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "1232yyqw22", - "datacenterId": "us20" - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": [ - { - "jobId": 5 - } - ], - "batched": false, - "statusCode": 400, - "error": "The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - } - } -] diff --git a/test/__tests__/data/mailchimp_input.json b/test/__tests__/data/mailchimp_input.json deleted file mode 100644 index 20b7ba0fc0..0000000000 --- a/test/__tests__/data/mailchimp_input.json +++ /dev/null @@ -1,1299 +0,0 @@ -[ - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com", - "firstName": "Bob", - "lastName": "Dole", - "zip": "123", - "state": "test", - "city": "test", - "addressLine1": "test", - "birthday": "2000-05-06" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "MailChimp": { - "subscriptionStatus": "subscribed" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "Titli Test", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "type": "identify", - "sentAt": "2021-05-18T06:58:57.186Z", - "userId": "test.rudderlabs@yara.com", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.18", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "https://app.rudderstack.com/sources/1qHR2Qzd894ievNGc4aBHmjltLD", - "path": "/sources/1qHR2Qzd894ievNGc4aBHmjltLD", - "title": "RudderStack", - "search": "", - "tab_url": "https://app.rudderstack.com/sources/1qHR2Qzd894ievNGc4aBHmjltLD", - "referrer": "$direct", - "initial_referrer": "https://www.google.com/", - "referring_domain": "", - "initial_referring_domain": "www.google.com" - }, - "locale": "en-US", - "screen": { - "width": 1792, - "height": 1120, - "density": 2 - }, - "traits": { - "name": "test rudderlabs", - "email": "test.rudderlabs@yara.com", - "userId": "1sWVaQTxoVwjvShC0295E6OqMaP", - "first_login": false, - "workspaceId": "1jWrHYPjNGSHbvKwzow0ZFPIQll", - "account_type": "invited" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.18" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" - }, - "rudderId": "6d612dda-9c8c-4062-9d09-af9425b846ce", - "messageId": "c6d49688-89f2-45cf-b061-0ae3c212a4e5", - "timestamp": "2021-05-18T06:58:57.811Z", - "receivedAt": "2021-05-18T06:58:57.812Z", - "request_ip": "122.172.221.51", - "anonymousId": "6914679f-fd34-45ef-86e0-4930e6e8b91a", - "integrations": { - "Salesforce": true - }, - "originalTimestamp": "2021-05-18T06:58:57.185Z" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "Titli Test", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "type": "page", - "sentAt": "2021-05-18T07:02:17.675Z", - "userId": "", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.18", - "namespace": "com.rudderlabs.javascript" - }, - "page": { - "url": "https://app.rudderstack.com/signup?type=freetrial", - "path": "/signup", - "title": "", - "search": "?type=freetrial", - "tab_url": "https://app.rudderstack.com/signup?type=freetrial", - "referrer": "https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e", - "initial_referrer": "https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e", - "referring_domain": "rudderstack.medium.com", - "initial_referring_domain": "rudderstack.medium.com" - }, - "locale": "en-GB", - "screen": { - "density": 2 - }, - "traits": {}, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.18" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" - }, - "rudderId": "4dbe224c-6aea-4d89-8da6-09d27c0d2908", - "messageId": "72df8cb0-54ab-417c-8e87-e97e9d339feb", - "timestamp": "2021-05-18T07:02:18.566Z", - "properties": { - "url": "https://app.rudderstack.com/signup?type=freetrial", - "path": "/signup", - "title": "", - "search": "?type=freetrial", - "tab_url": "https://app.rudderstack.com/signup?type=freetrial", - "referrer": "https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e", - "initial_referrer": "https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e", - "referring_domain": "rudderstack.medium.com", - "initial_referring_domain": "rudderstack.medium.com" - }, - "receivedAt": "2021-05-18T07:02:18.566Z", - "request_ip": "162.44.150.11", - "anonymousId": "58ec7b39-48f1-4d83-9d45-a48c64f96fa0", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-05-18T07:02:17.675Z" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "mappedToDestination": true, - "externalId": [ - { - "identifierType": "email_address", - "id": "bob.dole@initech.com", - "type": "audience" - } - ], - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "traits": { - "merge_fields": { - "FIRSTNAME": "Bob" - }, - "status": "subscribed" - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "type": "identify", - "traits": { - "status": "subscri" - }, - "userId": "emrichardson820+22822@gmail.com", - "channel": "sources", - "context": { - "sources": { - "job_id": "24c5HJxHomh6YCngEOCgjS5r1KX/Syncher", - "task_id": "vw_rs_mailchimp_mocked_hg_data", - "version": "v1.8.1", - "batch_id": "f252c69d-c40d-450e-bcd2-2cf26cb62762", - "job_run_id": "c8el40l6e87v0c4hkbl0", - "task_run_id": "c8el40l6e87v0c4hkblg" - }, - "externalId": [ - { - "id": "emrichardson820+22822@gmail.com", - "type": "MAILCHIMP-92e1f1ad2c", - "identifierType": "email_address" - } - ], - "mappedToDestination": "true" - }, - "recordId": "1", - "rudderId": "4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a", - "messageId": "b3bee036-fc26-4f6d-9867-c17f85708a82" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud112", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "jhon@gmail.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "bob.dole@initech.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "MailChimp": { - "subscriptionStatus": "subscribed" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "test-rudderlabs", - "email": "test-rudderlabs-test@initech.com", - "firstName": "Test", - "lastName": "Rudderlabs" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "test-rudderlabs", - "email": "test-rudderlabs-test@initech.com", - "firstName": "Test", - "lastName": "Rudderlabs" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "test-rudderlabs", - "email": "test-rudderlabs-test@initech.com", - "firstName": "Test", - "lastName": "Rudderlabs" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "test-rudderlabs", - "email": "test-rudderlabs-test@initech.com", - "firstName": "Test", - "lastName": "Rudderlabs" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "group", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments" - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false, - "products": [ - { - "product_id": "123", - "price": "14" - }, - { - "product_id": "123", - "price": 14 - } - ], - "purchased": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false, - "products": [ - { - "product_id": "123", - "price": "14" - }, - { - "product_id": "123", - "price": 14 - } - ], - "purchased": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": 22, - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false, - "products": [ - { - "product_id": "123", - "price": "14" - }, - { - "product_id": "123", - "price": 14 - } - ], - "purchased": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "E", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false, - "products": [ - { - "product_id": "123", - "price": "14" - }, - { - "product_id": "123", - "price": 14 - } - ], - "purchased": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "Event Name more than 30 characters abcdefghijklmno", - "userId": "userId12345" - } - } -] diff --git a/test/__tests__/data/mailchimp_output.json b/test/__tests__/data/mailchimp_output.json deleted file mode 100644 index e1a8384242..0000000000 --- a/test/__tests__/data/mailchimp_output.json +++ /dev/null @@ -1,498 +0,0 @@ -[ - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "merge_fields": { - "ADDRESS": { - "addr1": "test", - "city": "test", - "state": "test", - "zip": "123" - }, - "FNAME": "Bob", - "LNAME": "Dole", - "ANONYMOUSI": "userId12345", - "BIRTHDAY": "05/06" - }, - "email_address": "bob.dole@initech.com", - "status": "subscribed" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "status": "subscribed", - "email_address": "bob.dole@initech.com", - "merge_fields": { - "ANONYMOUSI": "userId12345" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "error": "User does not have access to the requested operation", - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "Titli Test", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey-dummyApiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "Titli Test", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apiKey", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "message type page is not supported" - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "merge_fields": { - "FIRSTNAME": "Bob" - }, - "status": "subscribed", - "email_address": "bob.dole@initech.com" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "94f71917d8522770c97449b0c90caa4c-usXX", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "ff21810ddc", - "datacenterId": "us14" - }, - "Enabled": true, - "Transformations": [] - }, - "statusCode": 400, - "error": "Email is required for identify", - "statTags": { - "destination": "mailchimp", - "stage": "transform", - "scope": "exception" - } - }, - { - "body": { - "XML": {}, - "FORM": {}, - "JSON": { - "status": "subscribed", - "email_address": "jhon@gmail.com" - }, - "JSON_ARRAY": {} - }, - "type": "REST", - "files": {}, - "method": "PUT", - "params": {}, - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "audienceId": "aud112", - "version": "1", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud112/members/7f3863b197eeff650876bb89eca08e57" - }, - { - "body": { - "XML": {}, - "FORM": {}, - "JSON": { - "email_address": "bob.dole@initech.com", - "status": "subscribed" - }, - "JSON_ARRAY": {} - }, - "type": "REST", - "files": {}, - "method": "PUT", - "params": {}, - "audienceId": "aud111", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "version": "1", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab" - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "status": "subscribed", - "email_address": "bob.dole@initech.com" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "API Key not found. Aborting" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "awesrdcfgvhbjnkkjhgf", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "Audience Id not found. Aborting" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "aud111", - "datacenterId": "" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "DataCenter Id not found. Aborting" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "zesrxdthfcjg345yruikyhntbgrafvd", - "audienceId": "aud111", - "datacenterId": "usXX" - }, - "Enabled": true, - "Transformations": [] - }, - "error": "message type group is not supported" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00", - "properties": { - "brand": "Aster", - "product": "Garments" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00", - "is_syncing": false, - "properties": { - "brand": "Aster", - "product": "Garments" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "error": "Email is required for track" - }, - { - "error": "Missing required value from \"event\"" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00" - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00", - "is_syncing": false, - "properties": { - "brand": "Aster", - "product": "Garments", - "products": "[{\"product_id\":\"123\",\"price\":\"14\"},{\"product_id\":\"123\",\"price\":14}]", - "purchased": "false" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmR1bW15QXBpS2V5" - }, - "params": {}, - "body": { - "JSON": { - "name": "22", - "occurred_at": "2019-11-15T10:26:53+00:00", - "is_syncing": false, - "properties": { - "brand": "Aster", - "product": "Garments", - "products": "[{\"product_id\":\"123\",\"price\":\"14\"},{\"product_id\":\"123\",\"price\":14}]", - "purchased": "false" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "ff21810ddc", - "datacenterId": "us14" - }, - "Enabled": true, - "Transformations": [] - }, - "statusCode": 400, - "error": "Event name should be between 2 and 30 characters", - "statTags": { - "destination": "mailchimp", - "stage": "transform", - "scope": "exception" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "dummyApiKey", - "audienceId": "ff21810ddc", - "datacenterId": "us14" - }, - "Enabled": true, - "Transformations": [] - }, - "statusCode": 400, - "error": "Event name should be between 2 and 30 characters", - "statTags": { - "destination": "mailchimp", - "stage": "transform", - "scope": "exception" - } - } -] diff --git a/test/__tests__/data/mailchimp_router_input.json b/test/__tests__/data/mailchimp_router_input.json deleted file mode 100644 index e3cdbdddf5..0000000000 --- a/test/__tests__/data/mailchimp_router_input.json +++ /dev/null @@ -1,347 +0,0 @@ -[ - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 2 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com", - "firstName": "Bob", - "lastName": "Dole" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "All": true - }, - "messageId": "21e475b2-3694-477b-afb6-5b94a81aac21", - "originalTimestamp": "2019-11-15T10:22:32Z", - "receivedAt": "2019-11-15T15:52:37+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:22:37Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:52:32+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 3 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "MailChimp": { - "subscriptionStatus": "subscribed" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 4 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "ip": "0.0.0.0", - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.0.0" - }, - "locale": "en-US", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" - }, - "integrations": { - "MailChimp": { - "subscriptionStatus": "subscrib" - } - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "request_ip": "[::1]:62921", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "identify", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 5 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments" - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 6 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "is_syncing": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "userId": "userId12345" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": { - "jobId": 7 - }, - "message": { - "anonymousId": "userId12345", - "channel": "web", - "context": { - "traits": { - "anonymousId": "userId12345", - "email": "bob.dole@initech.com" - } - }, - "properties": { - "brand": "Aster", - "product": "Garments", - "isSyncing": false, - "products": [ - { - "product_id": "123", - "price": "14" - }, - { - "product_id": "123", - "price": 14 - } - ], - "purchased": false - }, - "messageId": "6d1f3ca8-e2d0-4d34-9926-44596171af0c", - "originalTimestamp": "2019-11-15T10:26:53Z", - "receivedAt": "2019-11-15T15:56:58+05:30", - "sentAt": "2019-11-15T10:26:58Z", - "source_id": "1TdhTcwsUVOeEMWyPUpQIgF3pYr", - "timestamp": "2019-11-15T15:56:53+05:30", - "type": "track", - "event": "local testing", - "userId": "userId12345" - } - } -] diff --git a/test/__tests__/data/mailchimp_router_output.json b/test/__tests__/data/mailchimp_router_output.json deleted file mode 100644 index 3a3eec40a9..0000000000 --- a/test/__tests__/data/mailchimp_router_output.json +++ /dev/null @@ -1,238 +0,0 @@ -[ - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111?skip_merge_validation=true&skip_duplicate_check=false", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmFwaWtleQ==" - }, - "params": {}, - "body": { - "JSON": { - "members": [ - { - "email_address": "bob.dole@initech.com", - "merge_fields": { - "FNAME": "Bob", - "LNAME": "Dole", - "ANONYMOUSI": "userId12345" - }, - "status": "subscribed" - }, - { - "email_address": "bob.dole@initech.com", - "merge_fields": { - "ANONYMOUSI": "userId12345" - }, - "status": "subscribed" - } - ], - "update_existing": true - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 2 - }, - { - "jobId": 3 - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmFwaWtleQ==" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00", - "properties": { - "brand": "Aster", - "product": "Garments" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - "metadata": [ - { - "jobId": 5 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events", - "headers": { - "Content-Type": "application/json", - "Authorization": "Basic YXBpS2V5OmFwaWtleQ==" - }, - "params": {}, - "body": { - "JSON": { - "name": "local_testing", - "occurred_at": "2019-11-15T10:26:53+00:00", - "is_syncing": false, - "properties": { - "brand": "Aster", - "product": "Garments", - "products": "[{\"product_id\":\"123\",\"price\":\"14\"},{\"product_id\":\"123\",\"price\":14}]", - "purchased": "false" - } - }, - "XML": {}, - "JSON_ARRAY": {}, - "FORM": {} - }, - "files": {}, - "audienceId": "aud111" - }, - "metadata": [ - { - "jobId": 7 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": [ - { - "jobId": 6 - } - ], - "batched": false, - "statusCode": 400, - "error": "Missing required value from \"event\"", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - } - }, - { - "destination": { - "ID": "1Tdi0lpXwSVwXG1lcdP2pXHKrJ6", - "Name": "test-mc", - "DestinationDefinition": { - "ID": "1SujZGrVEPqYmpUJcV4vSl9tfxn", - "Name": "MC", - "DisplayName": "MailChimp" - }, - "Config": { - "apiKey": "apikey", - "audienceId": "aud111", - "datacenterId": "usXX", - "enableMergeFields": true - }, - "Enabled": true, - "Transformations": [] - }, - "metadata": [ - { - "jobId": 4 - } - ], - "batched": false, - "statusCode": 400, - "error": "The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]", - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - } - } -] diff --git a/test/__tests__/data/monday.json b/test/__tests__/data/monday.json deleted file mode 100644 index cec99959da..0000000000 --- a/test/__tests__/data/monday.json +++ /dev/null @@ -1,1023 +0,0 @@ -[ - { - "description": "Track call with empty columnToPropertyMapping", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "query": "mutation { create_item (board_id: 339283933, item_name: \"Task 1\", column_values: \"{}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.monday.com/v2", - "files": {}, - "headers": { - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track call with undefined columnToPropertyMapping", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "query": "mutation { create_item (board_id: 339283933, item_name: \"Task 1\", column_values: \"{}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.monday.com/v2", - "files": {}, - "headers": { - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Check Unsupported message type", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Event type identify is not supported" - } - }, - { - "description": "Check for empty message type", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Event type is required" - } - }, - { - "description": "Check for empty API Token", - "input": { - "destination": { - "Config": { - "apiToken": "", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "ApiToken is a required field" - } - }, - { - "description": "Check for empty board Id", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "boardId is a required field" - } - }, - { - "description": "Check for event name", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Event is a required field and should be a string" - } - }, - { - "description": "Track call with columnToPropertyMapping and with empty groupTitle", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.monday.com/v2", - "headers": { - "Content-Type": "application/json", - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih" - }, - "params": {}, - "body": { - "JSON": { - "query": "mutation { create_item (board_id: 339283933, item_name: \"Task 1\", column_values: \"{\\\"status\\\":{\\\"label\\\":\\\"Done\\\"},\\\"email\\\":{\\\"email\\\":\\\"abc@email.com\\\",\\\"text\\\":\\\"emailId\\\"}}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Track call with columnToPropertyMapping and with groupTitle", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.monday.com/v2", - "headers": { - "Content-Type": "application/json", - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih" - }, - "params": {}, - "body": { - "JSON": { - "query": "mutation { create_item (board_id: 339283933, group_id: group_title item_name: \"Task 1\", column_values: \"{\\\"status\\\":{\\\"label\\\":\\\"Done\\\"},\\\"email\\\":{\\\"email\\\":\\\"abc@email.com\\\",\\\"text\\\":\\\"emailId\\\"}}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "Non-existing group title check", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next year", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Group Next year doesn't exist in the board" - } - }, - { - "description": "check for item name", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Item name is required to create an item" - } - }, - { - "description": "Track call with columnToPropertyMapping and with groupTitle with all supported columns", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - }, - { - "from": "Checkbox", - "to": "checked" - }, - { - "from": "Numbers", - "to": "number" - }, - { - "from": "Name", - "to": "textKey" - }, - { - "from": "Country", - "to": "countryName" - }, - { - "from": "Location", - "to": "address" - }, - { - "from": "Phone", - "to": "phone" - }, - { - "from": "Rating", - "to": "rating" - }, - { - "from": "Link", - "to": "url" - }, - { - "from": "Long Text", - "to": "description" - }, - { - "from": "World Clock", - "to": "timezone" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId", - "countryCode": "US", - "latitude": "51.23", - "longitude": "35.3", - "rating": "3", - "linkText": "websiteLink", - "checked": "true", - "number": "45", - "textKey": "texting", - "countryName": "Unites States", - "countryShortName": "US", - "address": "New York", - "phone": "2626277272", - "url": "demo.com", - "description": "property description", - "timezone": "America/New_York" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.monday.com/v2", - "headers": { - "Content-Type": "application/json", - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih" - }, - "params": {}, - "body": { - "JSON": { - "query": "mutation { create_item (board_id: 339283933, group_id: group_title item_name: \"Task 1\", column_values: \"{\\\"status\\\":{\\\"label\\\":\\\"Done\\\"},\\\"email\\\":{\\\"email\\\":\\\"abc@email.com\\\",\\\"text\\\":\\\"emailId\\\"},\\\"checkbox\\\":{\\\"checked\\\":true},\\\"numbers\\\":\\\"45\\\",\\\"text\\\":\\\"texting\\\",\\\"country\\\":{\\\"countryName\\\":\\\"Unites States\\\",\\\"countryCode\\\":\\\"US\\\"},\\\"location\\\":{\\\"address\\\":\\\"New York\\\",\\\"lat\\\":\\\"51.23\\\",\\\"lng\\\":\\\"35.3\\\"},\\\"phone\\\":{\\\"phone\\\":\\\"2626277272\\\",\\\"countryShortName\\\":\\\"US\\\"},\\\"rating\\\":3,\\\"link\\\":{\\\"url\\\":\\\"demo.com\\\",\\\"text\\\":\\\"websiteLink\\\"},\\\"long_text\\\":{\\\"text\\\":\\\"property description\\\"},\\\"world_clock\\\":{\\\"timezone\\\":\\\"America/New_York\\\"}}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - }, - { - "description": "check for allowed event name from UI", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "Event Discarded. To allow this event, add this in Allowlist" - } - }, - { - "description": "check for deleted boards (configured boards are deleted)", - "input": { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283934", - "groupTitle": "Next year", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { - "from": "Email", - "to": "emailId" - } - ], - "whitelistedEvents": [ - { - "eventName": "create an item" - } - ] - } - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - "output": { - "error": "The board with boardId 339283934 does not exist" - } - } -] diff --git a/test/__tests__/data/monday_router_input.json b/test/__tests__/data/monday_router_input.json deleted file mode 100644 index 2770d23cb2..0000000000 --- a/test/__tests__/data/monday_router_input.json +++ /dev/null @@ -1,111 +0,0 @@ -[ - { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [{ "eventName": "create an item" }] - } - }, - "metadata": { - "jobId": 1 - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { "from": "Email", "to": "emailId" } - ], - "whitelistedEvents": [{ "eventName": "create an item" }] - } - }, - "metadata": { - "jobId": 2 - }, - "message": { - "event": "create an item", - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "user@27", - "channel": "web", - "properties": { - "name": "Task 1", - "status": "Done", - "emailId": "abc@email.com", - "emailText": "emailId" - }, - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - } -] diff --git a/test/__tests__/data/monday_router_output.json b/test/__tests__/data/monday_router_output.json deleted file mode 100644 index b0beb35a10..0000000000 --- a/test/__tests__/data/monday_router_output.json +++ /dev/null @@ -1,84 +0,0 @@ -[ - { - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "query": "mutation { create_item (board_id: 339283933, item_name: \"Task 1\", column_values: \"{}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.monday.com/v2", - "files": {}, - "headers": { - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "Content-Type": "application/json" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "", - "columnToPropertyMapping": [], - "whitelistedEvents": [{ "eventName": "create an item" }] - } - } - }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.monday.com/v2", - "headers": { - "Content-Type": "application/json", - "Authorization": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih" - }, - "params": {}, - "body": { - "JSON": { - "query": "mutation { create_item (board_id: 339283933, group_id: group_title item_name: \"Task 1\", column_values: \"{\\\"status\\\":{\\\"label\\\":\\\"Done\\\"},\\\"email\\\":{\\\"email\\\":\\\"abc@email.com\\\",\\\"text\\\":\\\"emailId\\\"}}\") {id}}" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "metadata": [ - { - "jobId": 2 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "apiToken": "eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih", - "boardId": "339283933", - "groupTitle": "Next month", - "columnToPropertyMapping": [ - { - "from": "Status", - "to": "status" - }, - { "from": "Email", "to": "emailId" } - ], - "whitelistedEvents": [{ "eventName": "create an item" }] - } - } - } -] diff --git a/test/__tests__/data/profitwell_input.json b/test/__tests__/data/profitwell_input.json deleted file mode 100644 index e73a17ad37..0000000000 --- a/test/__tests__/data/profitwell_input.json +++ /dev/null @@ -1,719 +0,0 @@ -[ - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "context": { - "externalId": [ - { - "type": "profitwellUserId", - "id": "23453" - } - ], - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "1234" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17rV" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17rV" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active", - "effectiveDate": "1609748705" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17rV" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "monthly", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active", - "effectiveDate": "1609748705" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17rV" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "activate", - "effectiveDate": "1609748705" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": {} - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17rV" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active", - "effectiveDate": "1609748705" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "externalId": [ - { - "type": "profitwellUserId", - "id": "pwu_Oea7HXV3bnTP" - }, - { - "type": "profitwellSubscriptionId", - "id": "pws_FecTCEyo17" - } - ], - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active", - "effectiveDate": "1609748705" - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - }, - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "message": { - "channel": "web", - "userId": "sp_245", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.1.9" - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.9" - }, - "locale": "en-GB", - "os": { - "name": "", - "version": "" - }, - "screen": { - "density": 2 - }, - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active", - "effectiveDate": 1609748705 - }, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" - }, - "messageId": "6a5f38c0-4e75-4268-a066-2b73fbcad01f", - "originalTimestamp": "2021-01-04T08:25:04.780Z", - "receivedAt": "2021-01-04T13:55:04.799+05:30", - "request_ip": "[::1]", - "rudderId": "79881a62-980a-4d76-89ca-7099440f8c13", - "sentAt": "2021-01-04T08:25:04.781Z", - "timestamp": "2021-09-06T14:15:06.798+05:30", - "type": "identify" - } - } -] diff --git a/test/__tests__/data/profitwell_output.json b/test/__tests__/data/profitwell_output.json deleted file mode 100644 index 04be6d990f..0000000000 --- a/test/__tests__/data/profitwell_output.json +++ /dev/null @@ -1,166 +0,0 @@ -[ - { - "statusCode": 400, - "error": "userId or userAlias is required for identify" - }, - { - "statusCode": 400, - "error": "No user found for profitwell user_id" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.profitwell.com/v2/subscriptions/", - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "params": {}, - "body": { - "JSON": { - "subscription_alias": "samual", - "email": "sample@sample.com", - "plan_id": "23", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": "23", - "user_alias": "sp_245", - "effective_date": 1630917906 - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "statusCode": 400, - "error": "subscriptionId or subscriptionAlias is required for identify" - }, - { - "statusCode": 400, - "error": "No user found for profitwell user_id" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.profitwell.com/v2/subscriptions/", - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "params": {}, - "body": { - "JSON": { - "subscription_alias": "samual", - "email": "sample@sample.com", - "plan_id": "23", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": "23", - "user_id": "pwu_Oea7HXV3bnTP", - "user_alias": "sp_245", - "effective_date": 1630917906 - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "statusCode": 400, - "error": "Missing required value from [\"traits.effectiveDate\",\"context.traits.effectiveDate\"]" - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://api.profitwell.com/v2/subscriptions/pws_FecTCEyo17rV/", - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "params": {}, - "body": { - "JSON": { - "plan_id": "23", - "plan_interval": "month", - "value": "23", - "status": "active", - "effective_date": 1609748705 - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "statusCode": 400, - "error": "invalid format for planInterval. Aborting" - }, - { - "version": "1", - "type": "REST", - "method": "PUT", - "endpoint": "https://api.profitwell.com/v2/subscriptions/pws_FecTCEyo17rV/", - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "params": {}, - "body": { - "JSON": { - "plan_id": "23", - "plan_interval": "month", - "value": "23", - "effective_date": 1609748705 - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - { - "statusCode": 400, - "error": "Private API Key not found. Aborting." - }, - { - "statusCode": 400, - "error": "Profitwell subscription_id not found" - }, - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://api.profitwell.com/v2/subscriptions/", - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "params": {}, - "body": { - "JSON": { - "subscription_alias": "samual", - "email": "sample@sample.com", - "plan_id": "23", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": "23", - "effective_date": 1609748705, - "user_alias": "sp_245" - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } -] diff --git a/test/__tests__/data/profitwell_router_input.json b/test/__tests__/data/profitwell_router_input.json deleted file mode 100644 index 50903283a7..0000000000 --- a/test/__tests__/data/profitwell_router_input.json +++ /dev/null @@ -1,45 +0,0 @@ -[ - { - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - }, - "metadata": { - "jobId": 2 - }, - "message": { - "channel": "web", - "context": { - "app": { - "build": "1.0.0", - "name": "RudderLabs JavaScript SDK", - "namespace": "com.rudderlabs.javascript", - "version": "1.0.0" - }, - "library": { "name": "RudderLabs JavaScript SDK", "version": "1.0.0" }, - "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", - "locale": "en-US", - "ip": "0.0.0.0", - "os": { "name": "", "version": "" }, - "screen": { "density": 2 } - }, - "messageId": "84e26acc-56a5-4835-8233-591137fca468", - "session_id": "3049dc4c-5a95-4ccd-a3e7-d74a7e411f22", - "originalTimestamp": "2019-10-14T09:03:17.562Z", - "type": "identify", - "userId": "samual", - "traits": { - "email": "sample@sample.com", - "planId": "23", - "planInterval": "month", - "planCurrency": "usd", - "value": "23", - "subscriptionAlias": "samual", - "status": "active" - }, - "integrations": { "All": true }, - "sentAt": "2019-10-14T09:03:22.563Z" - } - } -] diff --git a/test/__tests__/data/profitwell_router_output.json b/test/__tests__/data/profitwell_router_output.json deleted file mode 100644 index ca98903838..0000000000 --- a/test/__tests__/data/profitwell_router_output.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "batchedRequest": { - "body": { - "XML": {}, - "FORM": {}, - "JSON": { - "subscription_alias": "samual", - "email": "sample@sample.com", - "plan_id": "23", - "plan_interval": "month", - "plan_currency": "usd", - "status": "active", - "value": "23", - "user_alias": "samual", - "effective_date": 1571043797 - }, - "JSON_ARRAY": {} - }, - "type": "REST", - "files": {}, - "method": "POST", - "params": {}, - "headers": { - "Content-Type": "application/json", - "Authorization": "9270161a8e5abaa0e56efddfd9dbcb62" - }, - "version": "1", - "endpoint": "https://api.profitwell.com/v2/subscriptions/" - }, - "metadata": [ - { - "jobId": 2 - } - ], - "batched": false, - "statusCode": 200, - "destination": { - "Config": { - "privateApiKey": "9270161a8e5abaa0e56efddfd9dbcb62" - } - } - } -] diff --git a/test/__tests__/data/sendinblue.json b/test/__tests__/data/sendinblue.json deleted file mode 100644 index 06b6df14d9..0000000000 --- a/test/__tests__/data/sendinblue.json +++ /dev/null @@ -1,1196 +0,0 @@ -[ - { - "description": "Page call without email or phone", - "input": { - "message": { - "type": "page", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "name": "New Page", - "properties": { - "url": "https://www.google.com/", - "title": "Google home" - }, - "context": { - "traits": {}, - "page": { - "url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "path": "/Testing/test/ourSdk.html", - "title": "Document", - "search": "", - "tab_url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "referrer": "http://127.0.0.1:7307/Testing/test/", - "initial_referrer": "$direct", - "referring_domain": "127.0.0.1:7307", - "initial_referring_domain": "" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "At least one of `email` or `phone` is required" - } - }, - { - "description": "Page call", - "input": { - "message": { - "type": "page", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "name": "New Page", - "properties": { - "url": "https://www.google.com/", - "title": "Google home" - }, - "context": { - "traits": { - "email": "john_doe@example.com" - }, - "page": { - "url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "path": "/Testing/test/ourSdk.html", - "title": "Document", - "search": "", - "tab_url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "referrer": "http://127.0.0.1:7307/Testing/test/", - "initial_referrer": "$direct", - "referring_domain": "127.0.0.1:7307", - "initial_referring_domain": "" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": false, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "page": "https://www.google.com/", - "properties": { - "ma_path": "/Testing/test/ourSdk.html", - "ma_referrer": "http://127.0.0.1:7307/Testing/test/", - "ma_title": "Google home", - "sib_name": "New Page" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackPage", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track call without email or phone", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": {}, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "At least one of `email` or `phone` is required" - } - }, - { - "description": "Track call without event", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "properties": {}, - "context": {} - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "Event name is required" - } - }, - { - "description": "Track events with sendTraitsInTrack flag set to true", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": {}, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "sendTraitsInTrack": true - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "event": "Order Completed", - "eventdata": {}, - "properties": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "SMS": "+919876543210", - "age": 19, - "location": "Mumbai", - "role": "SDE" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackEvent", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track events with contactAttributeMapping provided in webapp", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": {}, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "sendTraitsInTrack": true - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "event": "Order Completed", - "eventdata": {}, - "properties": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "age": 19, - "role": "SDE" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackEvent", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track events with propertiesIdKey provided in integration object", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": { - "orderId": "1341394-3812392190", - "products": [ - { - "product_id": 1234, - "product_name": "Track Pants", - "amount": 1, - "price": 220 - }, - { - "product_id": 5768, - "product_name": "T-Shirt", - "amount": 5, - "price": 1058 - } - ] - }, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - } - }, - "integrations": { - "All": true, - "sendinblue": { - "propertiesIdKey": "orderId" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "sendTraitsInTrack": true - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "event": "Order Completed", - "eventdata": { - "data": { - "orderId": "1341394-3812392190", - "products": [ - { - "amount": 1, - "price": 220, - "product_id": 1234, - "product_name": "Track Pants" - }, - { - "amount": 5, - "price": 1058, - "product_id": 5768, - "product_name": "T-Shirt" - } - ] - }, - "id": "1341394-3812392190" - }, - "properties": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "age": 19, - "role": "SDE" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackEvent", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track events with eventdata.id taken from messageId", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": { - "orderId": "1341394-3812392190", - "products": [ - { - "product_id": 1234, - "product_name": "Track Pants", - "amount": 1, - "price": 220 - }, - { - "product_id": 5768, - "product_name": "T-Shirt", - "amount": 5, - "price": 1058 - } - ] - }, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "sendTraitsInTrack": true - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "event": "Order Completed", - "eventdata": { - "data": { - "orderId": "1341394-3812392190", - "products": [ - { - "amount": 1, - "price": 220, - "product_id": 1234, - "product_name": "Track Pants" - }, - { - "amount": 5, - "price": 1058, - "product_id": 5768, - "product_name": "T-Shirt" - } - ] - }, - "id": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff" - }, - "properties": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "age": 19, - "role": "SDE" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackEvent", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Track link without email or phone", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "trackLink", - "properties": { - "link": "https://www.google.com/gmail/", - "emailCount": 19 - }, - "context": { - "traits": {} - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "At least one of `email` or `phone` is required" - } - }, - { - "description": "Track link without link", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "trackLink", - "properties": {}, - "context": { - "traits": { - "phone": "+919507545089" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "Missing required value from \"properties.link\"" - } - }, - { - "description": "Track link", - "input": { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "trackLink", - "properties": { - "link": "https://www.google.com/gmail/", - "emailCount": 19 - }, - "context": { - "traits": { - "phone": "+919507545089" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "email": "919507545089@mailin-sms.com", - "link": "https://www.google.com/gmail/", - "properties": { - "emailCount": 19 - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackLink", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Identify call with invalid email", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { "email": "abc.com" }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "The provided email is invalid" - } - }, - { - "description": "Identify call with invalid phone number", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { "phone": "99999999" }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "The provided phone number is invalid" - } - }, - { - "description": "Identify call to create or update a contact without email or phone", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": { - "error": "At least one of `email` or `phone` is required" - } - }, - { - "description": "Identify call to create or update a contact", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "newEmail": "alex_root@example.com", - "role": "SDE" - }, - "context": { - "externalId": [ - { - "type": "sendinblueIncludeListIds", - "id": [1, 2] - } - ] - }, - "integrations": { - "All": true, - "sendinblue": { - "emailBlacklisted": true - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ] - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "attributes": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "EMAIL": "alex_root@example.com", - "age": 19, - "role": "SDE" - }, - "email": "john_doe@example.com", - "emailBlacklisted": true, - "listIds": [1, 2], - "updateEnabled": true - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Identify call to create DOI contact with templatedId from externalId", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - }, - "context": { - "externalId": [ - { - "type": "sendinblueIncludeListIds", - "id": [1, 2] - }, - { - "type": "sendinblueUnlinkListIds", - "id": [5] - }, - { - "type": "sendinblueTemplateId", - "id": 2 - } - ] - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "attributes": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "SMS": "+919876543210", - "age": 19, - "location": "Mumbai", - "role": "SDE" - }, - "email": "john_doe@example.com", - "includeListIds": [1, 2], - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard", - "templateId": 3 - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts/doubleOptinConfirmation", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Identify call to create DOI contact without include list Ids", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "error": "sendinblueIncludeListIds is required to create a contact using DOI" - } - }, - { - "description": "Identify call to create DOI contact without template Id", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "error": "templateId is required to create a contact using DOI" - } - }, - { - "description": "Identify call to update a DOI contact without an email or contact ID", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "Gordon", - "lastName": "Pittman", - "age": 19, - "location": "Mumbai", - "role": "SDE" - }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "error": "At least one of `email` or `contactId` is required to update the contact using DOI" - } - }, - { - "description": "Identify call to update a DOI contact using contactId as an Identifier and without include list Ids", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "age": 36, - "location": "Mumbai", - "role": "SDE 2" - }, - "context": { - "externalId": [ - { - "type": "sendinblueContactId", - "id": 42 - } - ] - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "attributes": { - "age": 36, - "location": "Mumbai", - "role": "SDE 2" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts/42", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "PUT", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Identify call to update a DOI contact using email as an Identifier and without include list Ids", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "age": 36, - "location": "Mumbai", - "role": "SDE 2", - "phone": "+918888888888", - "email": "gordon_pittman@example.com", - "newEmail": "gordon_pittman007@example.com" - }, - "context": { - "externalId": [ - { - "type": "sendinblueIncludeListIds", - "id": [1] - }, - { - "type": "sendinblueUnlinkListIds", - "id": [2] - } - ] - }, - "integrations": { - "All": true, - "sendinblue": { - "emailBlacklisted": true, - "smsBlacklisted": false - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - "output": { - "body": { - "FORM": {}, - "JSON": { - "attributes": { - "age": 36, - "location": "Mumbai", - "role": "SDE 2", - "SMS": "+918888888888", - "EMAIL": "gordon_pittman007@example.com" - }, - "emailBlacklisted": true, - "smsBlacklisted": false, - "listIds": [1], - "unlinkListIds": [2] - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts/gordon_pittman%40example.com", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "PUT", - "params": {}, - "type": "REST", - "version": "1" - } - }, - { - "description": "Identify call to unlink a contact from given lists", - "input": { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "email": "eric_kim@example.com" - }, - "context": { - "externalId": [ - { - "type": "sendinblueUnlinkListIds", - "id": [2, 5] - } - ] - } - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false - } - } - }, - "output": [ - { - "body": { - "FORM": {}, - "JSON": { - "emails": ["eric_kim@example.com"] - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts/lists/2/contacts/remove", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - { - "body": { - "FORM": {}, - "JSON": { - "emails": ["eric_kim@example.com"] - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts/lists/5/contacts/remove", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - } - ] - } -] diff --git a/test/__tests__/data/sendinblue_router_input.json b/test/__tests__/data/sendinblue_router_input.json deleted file mode 100644 index 1f2b8a1dc2..0000000000 --- a/test/__tests__/data/sendinblue_router_input.json +++ /dev/null @@ -1,187 +0,0 @@ -[ - { - "message": { - "type": "track", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "event": "Order Completed", - "properties": { - "orderId": "1341394-3812392190", - "products": [ - { - "product_id": 1234, - "product_name": "Track Pants", - "amount": 1, - "price": 220 - }, - { - "product_id": 5768, - "product_name": "T-Shirt", - "amount": 5, - "price": 1058 - } - ] - }, - "context": { - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "metadata": { - "jobId": 1 - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "sendTraitsInTrack": true - } - } - }, - { - "message": { - "type": "page", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "name": "New Page", - "properties": { - "url": "https://www.google.com/", - "title": "Google home" - }, - "context": { - "traits": { - "email": "john_doe@example.com" - }, - "page": { - "url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "path": "/Testing/test/ourSdk.html", - "title": "Document", - "search": "", - "tab_url": "http://127.0.0.1:7307/Testing/test/ourSdk.html", - "referrer": "http://127.0.0.1:7307/Testing/test/", - "initial_referrer": "$direct", - "referring_domain": "127.0.0.1:7307", - "initial_referring_domain": "" - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "metadata": { - "jobId": 2 - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": false, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - }, - { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "newEmail": "alex_root@example.com", - "role": "SDE" - }, - "context": { - "externalId": [ - { - "type": "sendinblueIncludeListIds", - "id": [1, 2] - } - ] - }, - "integrations": { - "All": true, - "sendinblue": { - "emailBlacklisted": true - } - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "metadata": { - "jobId": 3 - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ] - } - } - }, - { - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "channel": "web", - "traits": { - "first_name": "John", - "lastName": "Doe", - "age": 19, - "email": "john_doe@example.com", - "phone": "+919876543210", - "location": "Mumbai", - "role": "SDE" - }, - "context": {}, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "originalTimestamp": "2021-01-03T17:02:53.193Z" - }, - "metadata": { - "jobId": 4 - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - } -] diff --git a/test/__tests__/data/sendinblue_router_output.json b/test/__tests__/data/sendinblue_router_output.json deleted file mode 100644 index c15c15205c..0000000000 --- a/test/__tests__/data/sendinblue_router_output.json +++ /dev/null @@ -1,196 +0,0 @@ -[ - { - "batched": false, - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "event": "Order Completed", - "eventdata": { - "data": { - "orderId": "1341394-3812392190", - "products": [ - { - "amount": 1, - "price": 220, - "product_id": 1234, - "product_name": "Track Pants" - }, - { - "amount": 5, - "price": 1058, - "product_id": 5768, - "product_name": "T-Shirt" - } - ] - }, - "id": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff" - }, - "properties": { - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "age": 19, - "role": "SDE" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackEvent", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "doi": false, - "sendTraitsInTrack": true - } - }, - "metadata": [ - { - "jobId": 1 - } - ], - "statusCode": 200 - }, - { - "batched": false, - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "email": "john_doe@example.com", - "page": "https://www.google.com/", - "properties": { - "ma_path": "/Testing/test/ourSdk.html", - "ma_referrer": "http://127.0.0.1:7307/Testing/test/", - "ma_title": "Google home", - "sib_name": "New Page" - } - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://in-automate.sendinblue.com/api/v2/trackPage", - "files": {}, - "headers": { - "Content-Type": "application/json", - "ma-key": "clientKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "doi": false, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard", - "templateId": 3 - } - }, - "metadata": [ - { - "jobId": 2 - } - ], - "statusCode": 200 - }, - { - "batched": false, - "batchedRequest": { - "body": { - "FORM": {}, - "JSON": { - "attributes": { - "EMAIL": "alex_root@example.com", - "FIRSTNAME": "John", - "LASTNAME": "Doe", - "LOCATION": "Mumbai", - "SMS": "+919876543210", - "age": 19, - "role": "SDE" - }, - "email": "john_doe@example.com", - "emailBlacklisted": true, - "listIds": [1, 2], - "updateEnabled": true - }, - "JSON_ARRAY": {}, - "XML": {} - }, - "endpoint": "https://api.sendinblue.com/v3/contacts", - "files": {}, - "headers": { - "Content-Type": "application/json", - "api-key": "apiKey123" - }, - "method": "POST", - "params": {}, - "type": "REST", - "version": "1" - }, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "contactAttributeMapping": [ - { - "from": "location", - "to": "LOCATION" - } - ], - "doi": false - } - }, - "metadata": [ - { - "jobId": 3 - } - ], - "statusCode": 200 - }, - { - "batched": false, - "error": "sendinblueIncludeListIds is required to create a contact using DOI", - "metadata": [ - { - "jobId": 4 - } - ], - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "statusCode": 400, - "destination": { - "Config": { - "apiKey": "apiKey123", - "clientKey": "clientKey123", - "templateId": 3, - "doi": true, - "redirectionUrl": "https://app.sendinblue.com/marketing-dashboard" - } - } - } -] diff --git a/test/__tests__/klaviyo.test.js b/test/__tests__/klaviyo.test.js deleted file mode 100644 index 209811b007..0000000000 --- a/test/__tests__/klaviyo.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -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`); - -// Processor Test Data -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test Data -const routerTestDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router.json`) -); -const routerTestData = JSON.parse(routerTestDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - const output = await transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - - describe("Router", () => { - routerTestData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - const oldTransformerOutput = await transformer.processRouterDest(dataPoint.input); - const newTransformerOutput = await transformer.processRouterDest(dataPoint.input, { features: { [FEATURE_FILTER_CODE]: true } }); - expect(oldTransformerOutput).toEqual(dataPoint.oldTransformerOutput); - expect(newTransformerOutput).toEqual(dataPoint.newTransformerOutput); - }); - }); - }); -}); diff --git a/test/__tests__/kustomer.test.js b/test/__tests__/kustomer.test.js deleted file mode 100644 index 89c5e844a9..0000000000 --- a/test/__tests__/kustomer.test.js +++ /dev/null @@ -1,49 +0,0 @@ -const integration = "kustomer"; -const name = "Kustomer"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - inputData.forEach(async (input, index) => { - it(`Payload - ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/mailchimp.test.js b/test/__tests__/mailchimp.test.js deleted file mode 100644 index 5da9d572f7..0000000000 --- a/test/__tests__/mailchimp.test.js +++ /dev/null @@ -1,67 +0,0 @@ -const integration = "mailchimp"; -const name = "Mailchimp"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -const batchInputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_batch_input.json`) -); -const batchOutputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_batch_output.json`) -); - -const batchInputData = JSON.parse(batchInputDataFile); -const batchExpectedData = JSON.parse(batchOutputDataFile); - -describe(`${name} Tests`, () => { - describe("Processor Tests", () => { - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); - - describe("Batching", () => { - it("Payload", async () => { - const output = await transformer.processRouterDest(batchInputData); - expect(Array.isArray(output)).toEqual(true); - expect(output).toEqual(batchExpectedData); - }); - }); -}); diff --git a/test/__tests__/monday.test.js b/test/__tests__/monday.test.js deleted file mode 100644 index 0344cfcf75..0000000000 --- a/test/__tests__/monday.test.js +++ /dev/null @@ -1,46 +0,0 @@ -const fs = require("fs"); -const path = require("path"); - -const integration = "monday"; -const name = "Monday"; -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test Data -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - const output = await transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/profitwell.test.js b/test/__tests__/profitwell.test.js deleted file mode 100644 index 99ed1a4c43..0000000000 --- a/test/__tests__/profitwell.test.js +++ /dev/null @@ -1,62 +0,0 @@ -const fs = require("fs"); -const path = require("path"); -const { mockaxios } = require("../__mocks__/network"); - -const integration = "profitwell"; -const name = "profitwell"; -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -jest.mock("../../src/adapters/network", () => { - const originalModule = jest.requireActual("../../src/adapters/network"); - - //Mock the default export and named export 'send' - return { - __esModule: true, - ...originalModule, - send: jest.fn(mockaxios) - }; -}); - -describe(`${name} Tests`, () => { - describe("Processor Tests", () => { - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/sendinblue.test.js b/test/__tests__/sendinblue.test.js deleted file mode 100644 index 063f5bf282..0000000000 --- a/test/__tests__/sendinblue.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const integration = "sendinblue"; -const name = "Sendinblue"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach(async (dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - const output = await transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - - describe("Router", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/integrations/destinations/klaviyo/router/data.ts b/test/integrations/destinations/klaviyo/router/data.ts index 14329d36e9..0fb735d6bf 100644 --- a/test/integrations/destinations/klaviyo/router/data.ts +++ b/test/integrations/destinations/klaviyo/router/data.ts @@ -1,411 +1,464 @@ export const data = [ - { - name: 'klaviyo', - description: 'Test 0', - feature: 'router', - module: 'destination', - version: 'v0', - input: { - request: { - body: { - input: [ - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 1 - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "test", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "Testc", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 2 - }, - "message": { - "type": "identify", - "sentAt": "2021-01-03T17:02:53.195Z", - "userId": "test", - "channel": "web", - "context": { - "os": { - "name": "", - "version": "" - }, - "app": { - "name": "RudderLabs JavaScript SDK", - "build": "1.0.0", - "version": "1.1.11", - "namespace": "com.rudderlabs.javascript" - }, - "traits": { - "firstName": "Test", - "lastName": "Rudderlabs", - "email": "test@rudderstack.com", - "phone": "+12 345 578 900", - "userId": "test", - "title": "Developer", - "organization": "Rudder", - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001", - "Flagged": false, - "Residence": "Shibuya", - "properties": { - "listId": "XUepkK", - "subscribe": true, - "consent": ["email", "sms"] - } - }, - "locale": "en-US", - "screen": { - "density": 2 - }, - "library": { - "name": "RudderLabs JavaScript SDK", - "version": "1.1.11" - }, - "campaign": {}, - "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0" - }, - "rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f", - "messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff", - "anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35", - "integrations": { - "All": true - }, - "originalTimestamp": "2021-01-03T17:02:53.193Z" - } - }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } + { + name: 'klaviyo', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + metadata: { + jobId: 1, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'test', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + firstName: 'Test', + lastName: 'Rudderlabs', + email: 'test@rudderstack.com', + phone: '+12 345 578 900', + userId: 'Testc', + title: 'Developer', + organization: 'Rudder', + city: 'Tokyo', + region: 'Kanto', + country: 'JP', + zip: '100-0001', + Flagged: false, + Residence: 'Shibuya', + properties: { + consent: ['email', 'sms'], + }, + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + { + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + metadata: { + jobId: 2, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'test', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + firstName: 'Test', + lastName: 'Rudderlabs', + email: 'test@rudderstack.com', + phone: '+12 345 578 900', + userId: 'test', + title: 'Developer', + organization: 'Rudder', + city: 'Tokyo', + region: 'Kanto', + country: 'JP', + zip: '100-0001', + Flagged: false, + Residence: 'Shibuya', + properties: { + listId: 'XUepkK', + subscribe: true, + consent: ['email', 'sms'], + }, + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + { + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + metadata: { + jobId: 3, + }, + message: { + userId: 'user123', + type: 'group', + groupId: 'XUepkK', + traits: { + subscribe: true, + }, + context: { + traits: { + email: 'test@rudderstack.com', + phone: '+12 345 678 900', + consent: ['email'], + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-01-21T00:21:34.208Z', + }, + }, + { + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + metadata: { + jobId: 4, + }, + message: { + userId: 'user123', + type: 'random', + groupId: 'XUepkK', + traits: { + subscribe: true, + }, + context: { + traits: { + email: 'test@rudderstack.com', + phone: '+12 345 678 900', + consent: 'email', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-01-21T00:21:34.208Z', + }, + }, + { + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + metadata: { + jobId: 5, + }, + message: { + userId: 'user123', + type: 'group', + groupId: '', + traits: { + subscribe: true, + }, + context: { + traits: { + email: 'test@rudderstack.com', + phone: '+12 345 678 900', + consent: 'email', + }, + ip: '14.5.67.21', + library: { + name: 'http', + }, + }, + timestamp: '2020-01-21T00:21:34.208Z', + }, + }, + ], + destType: 'klaviyo', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: [ + { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs', + headers: { + Authorization: 'Klaviyo-API-Key dummyPrivateApiKey', + 'Content-Type': 'application/json', + Accept: 'application/json', + revision: '2023-02-22', + }, + params: {}, + body: { + JSON: { + data: { + type: 'profile-subscription-bulk-create-job', + attributes: { + list_id: 'XUepkK', + subscriptions: [ + { + email: 'test@rudderstack.com', + phone_number: '+12 345 678 900', }, - "metadata": { - "jobId": 3 + { + email: 'test@rudderstack.com', + phone_number: '+12 345 578 900', + channels: { + email: ['MARKETING'], + sms: ['MARKETING'], + }, }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": ["email"] - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } + ], }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 4 - }, - "message": { - "userId": "user123", - "type": "random", - "groupId": "XUepkK", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + { + version: '1', + type: 'REST', + method: 'PATCH', + endpoint: 'https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX', + headers: { + Authorization: 'Klaviyo-API-Key dummyPrivateApiKey', + 'Content-Type': 'application/json', + Accept: 'application/json', + revision: '2023-02-22', + }, + params: {}, + body: { + JSON: { + data: { + type: 'profile', + attributes: { + external_id: 'test', + email: 'test@rudderstack.com', + first_name: 'Test', + last_name: 'Rudderlabs', + phone_number: '+12 345 578 900', + title: 'Developer', + organization: 'Rudder', + location: { + city: 'Tokyo', + region: 'Kanto', + country: 'JP', + zip: '100-0001', + }, + properties: { + Flagged: false, + Residence: 'Shibuya', + }, }, - { - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - }, - "metadata": { - "jobId": 5 - }, - "message": { - "userId": "user123", - "type": "group", - "groupId": "", - "traits": { - "subscribe": true - }, - "context": { - "traits": { - "email": "test@rudderstack.com", - "phone": "+12 345 678 900", - "consent": "email" - }, - "ip": "14.5.67.21", - "library": { - "name": "http" - } - }, - "timestamp": "2020-01-21T00:21:34.208Z" - } - } - ], - destType: 'klaviyo', + id: '01GW3PHVY0MTCDGS0A1612HARX', + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + ], + metadata: [ + { + jobId: 3, + }, + { + jobId: 2, }, + ], + batched: true, + statusCode: 200, + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, }, - }, - output: { - response: { - status: 200, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'PATCH', + endpoint: 'https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX', + headers: { + Authorization: 'Klaviyo-API-Key dummyPrivateApiKey', + 'Content-Type': 'application/json', + Accept: 'application/json', + revision: '2023-02-22', + }, + params: {}, body: { - output: [ - { - "batchedRequest": [ - { - "version": "1", - "type": "REST", - "method": "POST", - "endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile-subscription-bulk-create-job", - "attributes": { - "list_id": "XUepkK", - "subscriptions": [ - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 678 900" - }, - { - "email": "test@rudderstack.com", - "phone_number": "+12 345 578 900", - "channels": { - "email": ["MARKETING"], - "sms": ["MARKETING"] - } - } - ] - } - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - } - ], - "metadata": [ - { - "jobId": 3 - }, - { - "jobId": 2 - } - ], - "batched": true, - "statusCode": 200, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } + JSON: { + data: { + type: 'profile', + attributes: { + external_id: 'test', + email: 'test@rudderstack.com', + first_name: 'Test', + last_name: 'Rudderlabs', + phone_number: '+12 345 578 900', + title: 'Developer', + organization: 'Rudder', + location: { + city: 'Tokyo', + region: 'Kanto', + country: 'JP', + zip: '100-0001', }, - { - "batchedRequest": { - "version": "1", - "type": "REST", - "method": "PATCH", - "endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX", - "headers": { - "Authorization": "Klaviyo-API-Key dummyPrivateApiKey", - "Content-Type": "application/json", - "Accept": "application/json", - "revision": "2023-02-22" - }, - "params": {}, - "body": { - "JSON": { - "data": { - "type": "profile", - "attributes": { - "external_id": "test", - "email": "test@rudderstack.com", - "first_name": "Test", - "last_name": "Rudderlabs", - "phone_number": "+12 345 578 900", - "title": "Developer", - "organization": "Rudder", - "location": { - "city": "Tokyo", - "region": "Kanto", - "country": "JP", - "zip": "100-0001" - }, - "properties": { - "Flagged": false, - "Residence": "Shibuya" - } - }, - "id": "01GW3PHVY0MTCDGS0A1612HARX" - } - }, - "JSON_ARRAY": {}, - "XML": {}, - "FORM": {} - }, - "files": {} - }, - "error": "{\"id\":\"01GW3PHVY0MTCDGS0A1612HARX\",\"attributes\":{}}", - "metadata": [ - { - "jobId": 1 - } - ], - "batched": false, - "statusCode": 299, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - }, - { - "error": "Event type random is not supported", - "metadata": [ - { - "jobId": 4 - } - ], - "batched": false, - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "statusCode": 400, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } + properties: { + Flagged: false, + Residence: 'Shibuya', }, - { - "error": "groupId is a required field for group events", - "metadata": [ - { - "jobId": 5 - } - ], - "batched": false, - "statTags": { - "errorCategory": "dataValidation", - "errorType": "instrumentation" - }, - "statusCode": 400, - "destination": { - "Config": { - "publicApiKey": "dummyPublicApiKey", - "privateApiKey": "dummyPrivateApiKey" - } - } - } - ] + }, + id: '01GW3PHVY0MTCDGS0A1612HARX', + }, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 1, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + }, + { + metadata: [ + { + jobId: 4, + }, + ], + batched: false, + statusCode: 400, + error: 'Event type random is not supported', + statTags: { + destType: 'KLAVIYO', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', + }, + }, + }, + { + metadata: [ + { + jobId: 5, + }, + ], + batched: false, + statusCode: 400, + error: 'groupId is a required field for group events', + statTags: { + destType: 'KLAVIYO', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + destination: { + Config: { + publicApiKey: 'dummyPublicApiKey', + privateApiKey: 'dummyPrivateApiKey', }, + }, }, + ], }, + }, }, + }, ]; diff --git a/test/integrations/destinations/kustomer/network.ts b/test/integrations/destinations/kustomer/network.ts new file mode 100644 index 0000000000..527b47ce2f --- /dev/null +++ b/test/integrations/destinations/kustomer/network.ts @@ -0,0 +1,423 @@ +export const networkCallsData = [ + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/externalId=annodD', + method: 'GET', + }, + httpRes: { + data: { + data: { + type: 'customer', + id: '58210c3db0f09110006b7953', + attributes: { + name: 'AnnoD', + displayName: 'AnnoD', + displayColor: 'yellow', + displayIcon: 'flower', + externalId: 'annodD', + externalIds: [ + { + externalId: 'annodD', + verified: true, + id: null, + }, + ], + sharedExternalIds: [], + signedUpAt: null, + avatarUrl: null, + username: null, + emails: [ + { + email: 'annod@kustomer.com', + verified: true, + type: 'home', + id: null, + }, + ], + sharedEmails: [ + { + email: 'annod@kustomer.com', + verified: false, + type: 'home', + id: null, + }, + ], + phones: [], + sharedPhones: [], + socials: [], + sharedSocials: [], + urls: [], + locations: [], + activeUsers: [], + watchers: [], + recentLocation: { + updatedAt: '2016-11-07T23:22:01.746Z', + }, + locale: null, + timeZone: null, + birthdayAt: null, + gender: null, + presence: 'offline', + createdAt: '2016-11-07T23:20:29.080Z', + updatedAt: '2016-11-09T04:47:07.036Z', + modifiedAt: '2016-11-09T04:47:07.036Z', + lastSeenAt: '2016-11-07T23:23:51.582Z', + lastActivityAt: '2016-11-09T04:47:07.036Z', + lastCustomerActivityAt: '2016-11-07T23:23:51.582Z', + lastMessageIn: { + sentAt: '2016-11-07T23:22:02.281Z', + sentiment: null, + }, + lastConversation: { + id: '58210c99b0f09110006b7969', + sentiment: { + confidence: 0.649023, + polarity: 1, + }, + tags: [], + }, + conversationCounts: { + all: 3, + snoozed: 0, + open: 2, + done: 1, + }, + preview: { + previewAt: '2016-11-07T23:23:26.039Z', + type: 'message_out', + text: 'dfsd fsdsfdsfdsf', + subject: 'Hi, do you guys have an XXL hoodie', + }, + tags: [], + sentiment: { + polarity: 1, + confidence: 0.649023, + }, + progressiveStatus: 'open', + verified: true, + rev: 37, + }, + relationships: { + org: { + links: { + self: '/v1/orgs/57f29863a1dbf61100e6aa92', + }, + data: { + type: 'org', + id: '57f29863a1dbf61100e6aa92', + }, + }, + messages: { + links: { + self: '/v1/customers/58210c3db0f09110006b7953/messages', + }, + }, + modifiedBy: { + links: { + self: '/v1/users/58190b991f2932100010d683', + }, + data: { + type: 'user', + id: '58190b991f2932100010d683', + }, + }, + }, + links: { + self: '/v1/customers/58210c3db0f09110006b7953', + }, + }, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/externalId=58210c3db0f09110006b7953', + method: 'GET', + }, + httpRes: { + data: { + data: { + type: 'customer', + id: '58210c3db0f09110006b7953', + attributes: { + name: 'AnnoD', + displayName: 'AnnoD', + displayColor: 'yellow', + displayIcon: 'flower', + externalId: 'annodD', + externalIds: [ + { + externalId: 'annodD', + verified: true, + id: null, + }, + ], + sharedExternalIds: [], + signedUpAt: null, + avatarUrl: null, + username: null, + emails: [ + { + email: 'annod@kustomer.com', + verified: true, + type: 'home', + id: null, + }, + ], + sharedEmails: [ + { + email: 'annod@kustomer.com', + verified: false, + type: 'home', + id: null, + }, + ], + phones: [], + sharedPhones: [], + socials: [], + sharedSocials: [], + urls: [], + locations: [], + activeUsers: [], + watchers: [], + recentLocation: { + updatedAt: '2016-11-07T23:22:01.746Z', + }, + locale: null, + timeZone: null, + birthdayAt: null, + gender: null, + presence: 'offline', + createdAt: '2016-11-07T23:20:29.080Z', + updatedAt: '2016-11-09T04:47:07.036Z', + modifiedAt: '2016-11-09T04:47:07.036Z', + lastSeenAt: '2016-11-07T23:23:51.582Z', + lastActivityAt: '2016-11-09T04:47:07.036Z', + lastCustomerActivityAt: '2016-11-07T23:23:51.582Z', + lastMessageIn: { + sentAt: '2016-11-07T23:22:02.281Z', + sentiment: null, + }, + lastConversation: { + id: '58210c99b0f09110006b7969', + sentiment: { + confidence: 0.649023, + polarity: 1, + }, + tags: [], + }, + conversationCounts: { + all: 3, + snoozed: 0, + open: 2, + done: 1, + }, + preview: { + previewAt: '2016-11-07T23:23:26.039Z', + type: 'message_out', + text: 'dfsd fsdsfdsfdsf', + subject: 'Hi, do you guys have an XXL hoodie', + }, + tags: [], + sentiment: { + polarity: 1, + confidence: 0.649023, + }, + progressiveStatus: 'open', + verified: true, + rev: 37, + }, + relationships: { + org: { + links: { + self: '/v1/orgs/57f29863a1dbf61100e6aa92', + }, + data: { + type: 'org', + id: '57f29863a1dbf61100e6aa92', + }, + }, + messages: { + links: { + self: '/v1/customers/58210c3db0f09110006b7953/messages', + }, + }, + modifiedBy: { + links: { + self: '/v1/users/58190b991f2932100010d683', + }, + data: { + type: 'user', + id: '58190b991f2932100010d683', + }, + }, + }, + links: { + self: '/v1/customers/58210c3db0f09110006b7953', + }, + }, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.prod2.kustomerapp.com/v1/customers/externalId=58210c3db0f09110006b7953', + method: 'GET', + }, + httpRes: { + data: { + data: { + type: 'customer', + id: '58210c3db0f09110006b7953', + attributes: { + name: 'AnnoD', + displayName: 'AnnoD', + displayColor: 'yellow', + displayIcon: 'flower', + externalId: 'annodD', + externalIds: [ + { + externalId: 'annodD', + verified: true, + id: null, + }, + ], + sharedExternalIds: [], + signedUpAt: null, + avatarUrl: null, + username: null, + emails: [ + { + email: 'annod@kustomer.com', + verified: true, + type: 'home', + id: null, + }, + ], + sharedEmails: [ + { + email: 'annod@kustomer.com', + verified: false, + type: 'home', + id: null, + }, + ], + phones: [], + sharedPhones: [], + socials: [], + sharedSocials: [], + urls: [], + locations: [], + activeUsers: [], + watchers: [], + recentLocation: { + updatedAt: '2016-11-07T23:22:01.746Z', + }, + locale: null, + timeZone: null, + birthdayAt: null, + gender: null, + presence: 'offline', + createdAt: '2016-11-07T23:20:29.080Z', + updatedAt: '2016-11-09T04:47:07.036Z', + modifiedAt: '2016-11-09T04:47:07.036Z', + lastSeenAt: '2016-11-07T23:23:51.582Z', + lastActivityAt: '2016-11-09T04:47:07.036Z', + lastCustomerActivityAt: '2016-11-07T23:23:51.582Z', + lastMessageIn: { + sentAt: '2016-11-07T23:22:02.281Z', + sentiment: null, + }, + lastConversation: { + id: '58210c99b0f09110006b7969', + sentiment: { + confidence: 0.649023, + polarity: 1, + }, + tags: [], + }, + conversationCounts: { + all: 3, + snoozed: 0, + open: 2, + done: 1, + }, + preview: { + previewAt: '2016-11-07T23:23:26.039Z', + type: 'message_out', + text: 'dfsd fsdsfdsfdsf', + subject: 'Hi, do you guys have an XXL hoodie', + }, + tags: [], + sentiment: { + polarity: 1, + confidence: 0.649023, + }, + progressiveStatus: 'open', + verified: true, + rev: 37, + }, + relationships: { + org: { + links: { + self: '/v1/orgs/57f29863a1dbf61100e6aa92', + }, + data: { + type: 'org', + id: '57f29863a1dbf61100e6aa92', + }, + }, + messages: { + links: { + self: '/v1/customers/58210c3db0f09110006b7953/messages', + }, + }, + modifiedBy: { + links: { + self: '/v1/users/58190b991f2932100010d683', + }, + data: { + type: 'user', + id: '58190b991f2932100010d683', + }, + }, + }, + links: { + self: '/v1/customers/58210c3db0f09110006b7953', + }, + }, + }, + status: 204, + }, + }, + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/externalId=Testc', + method: 'GET', + }, + httpRes: { error: 'Request failed', status: 404 }, + }, + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/email=test@rudderstack.com', + method: 'GET', + }, + httpRes: { error: 'Request failed', status: 404 }, + }, + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/externalId=97c46c81-3140-456d-b2a9-690d70aaca35', + method: 'GET', + }, + httpRes: { error: 'Request failed', status: 404 }, + }, + { + httpReq: { + url: 'https://api.kustomerapp.com/v1/customers/externalId=testc', + method: 'GET', + }, + httpRes: { error: 'Request failed', status: 404 }, + }, +]; diff --git a/test/integrations/destinations/kustomer/processor/data.ts b/test/integrations/destinations/kustomer/processor/data.ts new file mode 100644 index 0000000000..ba8407baaf --- /dev/null +++ b/test/integrations/destinations/kustomer/processor/data.ts @@ -0,0 +1,1901 @@ +export const data = [ + { + name: 'kustomer', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'Testc', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + name: 'Test Rudderlabs', + email: 'test@rudderstack.com', + phone: '+12345578900', + birthday: '2005-01-01T23:28:56.782Z', + userId: 'Testc', + address: { + street: '24 Dovers Lane', + city: 'Miami', + state: 'Florida', + postalCode: '1890001', + }, + userName: 'Testc47', + company: 'Rudderstack', + createdAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatar: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + website: 'www.mattertoast873.com', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/customers', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'Test Rudderlabs', + externalId: 'Testc', + username: 'Testc47', + company: 'Rudderstack', + signedUpAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatarUrl: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + locale: 'en-US', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + birthdayAt: '2005-01-01T23:28:56.782Z', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + urls: [ + { + url: 'www.mattertoast873.com', + }, + ], + locations: [ + { + type: 'home', + address: '24 Dovers Lane Miami Florida 1890001', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + userId: '58210c3db0f09110006b7953', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + name: 'Ano Domeni', + phone: '+12345578000', + birthday: '2005-01-01T23:28:56.782Z', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: + 'https://api.kustomerapp.com/v1/customers/58210c3db0f09110006b7953?replace=false', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'Ano Domeni', + externalId: '58210c3db0f09110006b7953', + locale: 'en-US', + birthdayAt: '2005-01-01T23:28:56.782Z', + phones: [ + { + type: 'home', + phone: '+12345578000', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'screen', + event: 'Test-Event-Screen', + sentAt: '2021-01-25T16:12:02.048Z', + userId: 'Testc', + channel: 'mobile', + context: { + os: { + name: 'Android', + version: '10', + }, + app: { + name: 'KlaviyoTest', + build: '1', + version: '1.0', + namespace: 'com.rudderstack.android.rudderstack.sampleAndroidApp', + }, + device: { + id: '9c6bd77ea9da3e68', + name: 'raphaelin', + type: 'android', + model: 'Redmi K20 Pro', + manufacturer: 'Xiaomi', + }, + locale: 'en-IN', + screen: { + width: 1080, + height: 2210, + density: 440, + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.2', + }, + network: { + wifi: true, + carrier: 'airtel', + cellular: true, + bluetooth: false, + }, + timezone: 'Asia/Kolkata', + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)', + }, + rudderId: 'b7b24f86-f7bf-46d8-b2b4-ccafc080239c', + messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', + properties: { + hasAccount: 'true', + YearSelectedNum: 1801, + originalServing: '2021-01-25T15:32:56.409Z', + }, + anonymousId: '9c6bd77ea9da3e68', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-25T15:32:56.409Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'Testc', + }, + event: { + name: 'Screen-Viewed-Test-Event-Screen', + meta: { + hasAccount: 'true', + YearSelectedNum: 1801, + originalServing: '2021-01-25T15:32:56.409Z', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + name: 'Cart-Viewed', + type: 'page', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + locale: 'en-US', + screen: { + density: 2, + }, + traits: { + userId: 'userid', + profession: 'Student', + anonymousId: 'd80b66d5-b33d-412d-866f-r4fft5841af', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + category: 'Cart', + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + url: 'http://morkey.in', + name: 'Cart Viewed', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Web-Page-Viewed-Cart-Viewed', + meta: { + url: 'http://morkey.in', + name: 'Cart Viewed', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'page', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + locale: 'en-US', + screen: { + density: 2, + }, + traits: { + userId: 'userid', + profession: 'Student', + anonymousId: 'd80b66d5-b33d-412d-866f-r4fft5841af', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + category: 'Cart', + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + kustomerTrackingId: '829131sjad', + kustomerSessionId: 'hsad522', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Web-Page-Viewed', + sessionId: 'hsad522', + trackingId: '829131sjad', + meta: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'track', + event: 'Tracking-Weekender', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + YearServicedNum: 211, + region: 'strapis', + kustomerTrackingId: 'sahetwiac', + kustomerSessionId: '63nsa22', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + locale: 'en-US', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Tracking-Weekender', + sessionId: '63nsa22', + trackingId: 'sahetwiac', + meta: { + YearServicedNum: 211, + region: 'strapis', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'track', + event: 'Tracking-Weekender2', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + YearServicedNum: 211, + 'reg_8-821x': false, + kustomer_tracking_id: 'sahetwiac', + kustomer_session_id: '63nsa22', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + locale: 'en-US', + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + FORM: {}, + JSON: { + event: { + meta: { + YearServicedNum: 211, + 'reg_8-821x': false, + }, + name: 'Tracking-Weekender2', + sessionId: '63nsa22', + trackingId: 'sahetwiac', + }, + identity: { + externalId: 'user@doe', + }, + }, + XML: {}, + JSON_ARRAY: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + genericPage: true, + }, + }, + message: { + type: 'page', + name: 'Unfinished page', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + locale: 'en-US', + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Web-Page-Viewed', + meta: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + category: 'Cart', + referrer: 'morkey', + domain: 'morkey.com', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + genericScreen: true, + }, + }, + message: { + type: 'screen', + event: 'Test-Event-Screen', + sentAt: '2021-01-25T16:12:02.048Z', + userId: 'Testc', + channel: 'mobile', + context: { + os: { + name: 'Android', + version: '10', + }, + app: { + name: 'KlaviyoTest', + build: '1', + version: '1.0', + namespace: 'com.rudderstack.android.rudderstack.sampleAndroidApp', + }, + device: { + id: '9c6bd77ea9da3e68', + name: 'raphaelin', + type: 'android', + model: 'Redmi K20 Pro', + manufacturer: 'Xiaomi', + }, + locale: 'en-IN', + screen: { + width: 1080, + height: 2210, + density: 440, + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.2', + }, + network: { + wifi: true, + carrier: 'airtel', + cellular: true, + bluetooth: false, + }, + timezone: 'Asia/Kolkata', + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)', + }, + rudderId: 'b7b24f86-f7bf-46d8-b2b4-ccafc080239c', + messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', + properties: { + hasAccount: 'true', + YearSelectedNum: 1801, + originalServing: '2021-01-25T15:32:56.409Z', + }, + anonymousId: '9c6bd77ea9da3e68', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-25T15:32:56.409Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'Testc', + }, + event: { + name: 'Screen-Viewed', + meta: { + hasAccount: 'true', + YearSelectedNum: 1801, + originalServing: '2021-01-25T15:32:56.409Z', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'Testc', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + firstName: 'Test', + lastName: 'Rudderlabs', + email: 'test@rudderstack.com', + phone: '+12345578900', + birthday: '2005-01-01T23:28:56.782Z', + userId: 'Testc', + address: { + street: '24 Dovers Lane', + city: 'Miami', + state: 'Florida', + postalCode: '1890001', + }, + userName: 'Testc47', + company: 'Rudderstack', + createdAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatar: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + website: 'www.mattertoast873.com', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/customers', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'Test Rudderlabs', + externalId: 'Testc', + username: 'Testc47', + company: 'Rudderstack', + signedUpAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatarUrl: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + locale: 'en-US', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + birthdayAt: '2005-01-01T23:28:56.782Z', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + urls: [ + { + url: 'www.mattertoast873.com', + }, + ], + locations: [ + { + type: 'home', + address: '24 Dovers Lane Miami Florida 1890001', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'Testc', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + firstName: 'Test', + lastName: 'Rudderlabs', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + birthday: '2005-01-01T23:28:56.782Z', + userId: 'Testc', + address: 'test address string', + userName: 'Testc47', + company: 'Rudderstack', + createdAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatar: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + website: 'www.mattertoast873.com', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/customers', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'Test Rudderlabs', + externalId: 'Testc', + username: 'Testc47', + company: 'Rudderstack', + signedUpAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatarUrl: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + locale: 'en-US', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + birthdayAt: '2005-01-01T23:28:56.782Z', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + urls: [ + { + url: 'www.mattertoast873.com', + }, + ], + locations: [ + { + type: 'home', + address: 'test address string', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 11', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + }, + }, + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'Testc', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + firstName: 'Test', + lastName: 'Rudderlabs', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + birthday: '2005-01-01T23:28:56.782Z', + userId: 'Testc', + address: 'test address string', + userName: 'Testc47', + company: 'Rudderstack', + createdAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatar: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + website: 'www.mattertoast873.com', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + externalId: [ + { + type: 'kustomerId', + id: 'abcd1234', + }, + ], + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { + All: true, + }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: 'https://api.kustomerapp.com/v1/customers/abcd1234?replace=false', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'Test Rudderlabs', + externalId: 'Testc', + username: 'Testc47', + company: 'Rudderstack', + signedUpAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatarUrl: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + locale: 'en-US', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@Testc', + url: 'http://twitter.com/Testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'Testc', + url: 'http://facebook.com/Testc', + }, + ], + birthdayAt: '2005-01-01T23:28:56.782Z', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + urls: [ + { + url: 'www.mattertoast873.com', + }, + ], + locations: [ + { + type: 'home', + address: 'test address string', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 12', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + genericScreen: true, + }, + }, + message: { + type: 'screen', + event: 'Test-Event-Screen', + userId: 'utsabc', + channel: 'mobile', + context: { + os: { + name: 'Android', + version: '10', + }, + app: { + name: 'KlaviyoTest', + build: '1', + version: '1.0', + namespace: 'com.rudderstack.android.rudderstack.sampleAndroidApp', + }, + device: { + id: '9c6bd77ea9da3e68', + name: 'raphaelin', + type: 'android', + model: 'Redmi K20 Pro', + manufacturer: 'Xiaomi', + }, + locale: 'en-IN', + screen: { + width: 1080, + height: 2210, + density: 440, + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.2', + }, + network: { + wifi: true, + carrier: 'airtel', + cellular: true, + bluetooth: false, + }, + timezone: 'Asia/Kolkata', + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)', + sessionId: 'hsad522', + }, + rudderId: 'b7b24f86-f7bf-46d8-b2b4-ccafc080239c', + messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', + properties: { + hasAccount: 'true', + YearSelectedNum: 1801, + }, + anonymousId: '9c6bd77ea9da3e68', + integrations: { + All: true, + }, + originalTimestamp: '2023-01-10T15:32:56.409Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'utsabc', + }, + event: { + name: 'Screen-Viewed', + sessionId: 'hsad522', + meta: { + hasAccount: 'true', + YearSelectedNum: 1801, + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'kustomer', + description: 'Test 13', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiKey: 'dummyApiKey', + baseEndpoint: 'https://api.prod2.kustomerapp.com', + genericScreen: true, + }, + }, + message: { + type: 'screen', + event: 'Test-Event-Screen', + userId: 'Testc', + channel: 'mobile', + context: { + os: { + name: 'Android', + version: '10', + }, + app: { + name: 'KlaviyoTest', + build: '1', + version: '1.0', + namespace: 'com.rudderstack.android.rudderstack.sampleAndroidApp', + }, + device: { + id: '9c6bd77ea9da3e68', + name: 'raphaelin', + type: 'android', + model: 'Redmi K20 Pro', + manufacturer: 'Xiaomi', + }, + locale: 'en-IN', + screen: { + width: 1080, + height: 2210, + density: 440, + }, + library: { + name: 'com.rudderstack.android.sdk.core', + version: '1.0.2', + }, + network: { + wifi: true, + carrier: 'airtel', + cellular: true, + bluetooth: false, + }, + timezone: 'Asia/Kolkata', + userAgent: + 'Dalvik/2.1.0 (Linux; U; Android 10; Redmi K20 Pro MIUI/V12.0.4.0.QFKINXM)', + sessionId: 'hsad522', + }, + rudderId: 'b7b24f86-f7bf-46d8-b2b4-ccafc080239c', + messageId: '1611588776408-ee5a3212-fbf9-4cbb-bbad-3ed0f7c6a2ce', + properties: { + hasAccount: 'true', + YearSelectedNum: 1801, + }, + anonymousId: '9c6bd77ea9da3e68', + integrations: { + All: true, + }, + originalTimestamp: '2023-01-10T15:32:56.409Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.prod2.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'Testc', + }, + event: { + name: 'Screen-Viewed', + sessionId: 'hsad522', + meta: { + hasAccount: 'true', + YearSelectedNum: 1801, + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/kustomer/router/data.ts b/test/integrations/destinations/kustomer/router/data.ts new file mode 100644 index 0000000000..6dae5d5e76 --- /dev/null +++ b/test/integrations/destinations/kustomer/router/data.ts @@ -0,0 +1,393 @@ +export const data = [ + { + name: 'kustomer', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'testc', + channel: 'web', + context: { + os: { name: '', version: '' }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + traits: { + name: 'test Rudderlabs', + email: 'test@rudderstack.com', + phone: '+12345578900', + birthday: '2005-01-01T23:28:56.782Z', + userId: 'testc', + address: { + street: '24 Dovers Lane', + city: 'Miami', + state: 'Florida', + postalCode: '1890001', + }, + userName: 'testc47', + company: 'Rudderstack', + createdAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatar: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + website: 'www.mattertoast873.com', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@testc', + url: 'http://twitter.com/testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'testc', + url: 'http://facebook.com/testc', + }, + ], + }, + locale: 'en-US', + screen: { density: 2 }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.1.11' }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + integrations: { All: true }, + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + metadata: { + jobId: 1, + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + { + message: { + type: 'track', + event: 'Tracking-Weekender', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { name: '', version: '' }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + locale: 'en-US', + screen: { density: 2 }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.1.11' }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + YearServicedNum: 211, + region: 'strapis', + kustomerTrackingId: 'sahetwiac', + kustomerSessionId: '63nsa22', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + locale: 'en-US', + integrations: { All: true }, + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + metadata: { + jobId: 2, + }, + destination: { + Config: { + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + { + message: { + type: 'track', + event: 'Tracking-Weekender', + sentAt: '2021-01-03T17:02:53.197Z', + userId: 'user@doe', + channel: 'web', + context: { + os: { name: '', version: '' }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'http://morkey.in', + path: '/cart', + title: 'miphone', + search: 'MI', + referrer: 'morkey', + }, + locale: 'en-US', + screen: { density: 2 }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.1.11' }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '15129730-eb00-4db7-8db2-799566ccb2ef', + properties: { + YearServicedNum: 211, + region: 'strapis', + kustomerTrackingId: 'sahetwiac', + kustomerSessionId: '63nsa22', + }, + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + locale: 'en-US', + integrations: { All: true }, + originalTimestamp: '2021-01-03T17:02:53.195Z', + }, + metadata: { + jobId: 2, + }, + destination: { + Config: { + baseEndpoint: 'https://api.prod2.kustomerapp.com', + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + ], + destType: 'kustomer', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/customers', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + name: 'test Rudderlabs', + externalId: 'testc', + username: 'testc47', + company: 'Rudderstack', + signedUpAt: '2015-04-17T12:37:42.146Z', + lastActivityAt: '2016-04-17T12:37:42.146Z', + lastCustomerActivityAt: '2017-04-17T12:37:42.146Z', + lastSeenAt: '2017-04-17T12:37:42.146Z', + avatarUrl: 'https://homepages.cae.wisc.edu/~ece533/images/boat.png', + gender: 'm', + tags: ['happy', 'satisfied'], + locale: 'en-US', + socials: [ + { + verified: true, + userid: '100', + type: 'twitter', + username: '@testc', + url: 'http://twitter.com/testc', + }, + { + verified: false, + userid: '200', + type: 'facebook', + username: 'testc', + url: 'http://facebook.com/testc', + }, + ], + birthdayAt: '2005-01-01T23:28:56.782Z', + emails: [ + { + type: 'home', + email: 'test@rudderstack.com', + }, + ], + phones: [ + { + type: 'home', + phone: '+12345578900', + }, + ], + urls: [ + { + url: 'www.mattertoast873.com', + }, + ], + locations: [ + { + type: 'home', + address: '24 Dovers Lane Miami Florida 1890001', + }, + ], + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 1, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Tracking-Weekender', + sessionId: '63nsa22', + trackingId: 'sahetwiac', + meta: { + YearServicedNum: 211, + region: 'strapis', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 2, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.prod2.kustomerapp.com/v1/tracking/identityEvent', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Bearer dummyApiKey', + }, + params: {}, + body: { + JSON: { + identity: { + externalId: 'user@doe', + }, + event: { + name: 'Tracking-Weekender', + sessionId: '63nsa22', + trackingId: 'sahetwiac', + meta: { + YearServicedNum: 211, + region: 'strapis', + }, + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 2, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + baseEndpoint: 'https://api.prod2.kustomerapp.com', + apiKey: 'dummyApiKey', + genericPage: false, + genericScreen: false, + }, + }, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/mailchimp/network.ts b/test/integrations/destinations/mailchimp/network.ts new file mode 100644 index 0000000000..b036bf566c --- /dev/null +++ b/test/integrations/destinations/mailchimp/network.ts @@ -0,0 +1,80 @@ +export const networkCallsData = [ + { + httpReq: { + url: 'https://usXXX.api.mailchimp.com/3.0/lists/aud111/members/0b63fa319d113aede8b7b409e4fc6437', + method: 'GET', + }, + httpRes: { + data: { + data: { + type: 'https://mailchimp.com/developer/marketing/docs/errors/', + title: 'Forbidden', + status: 403, + detail: "The API key provided is linked to datacenter 'us6'", + instance: 'ff092056-4d86-aa05-bbe9-9e9466108d81', + }, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + method: 'GET', + }, + httpRes: { + data: { + contact_id: 821932121, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/b599284b872e06d29bb796a260ae7c1f', + method: 'GET', + }, + httpRes: { + data: { + contact_id: 821932121, + }, + status: 204, + }, + }, + { + httpReq: { + url: 'https://usXX.api.mailchimp.com/3.0/lists/aud000', + method: 'GET', + }, + httpRes: { + data: { + double_optin: false, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://usXX.api.mailchimp.com/3.0/lists/aud112', + method: 'GET', + }, + httpRes: { + data: { + double_optin: false, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://usXX.api.mailchimp.com/3.0/lists/aud002', + method: 'GET', + }, + httpRes: { + data: { + double_optin: false, + }, + status: 200, + }, + }, +]; diff --git a/test/integrations/destinations/mailchimp/processor/data.ts b/test/integrations/destinations/mailchimp/processor/data.ts new file mode 100644 index 0000000000..a0ee5de3d3 --- /dev/null +++ b/test/integrations/destinations/mailchimp/processor/data.ts @@ -0,0 +1,2259 @@ +export const data = [ + { + name: 'mailchimp', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + firstName: 'Bob', + lastName: 'Dole', + zip: '123', + state: 'test', + city: 'test', + addressLine1: 'test', + birthday: '2000-05-06', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + merge_fields: { + ADDRESS: { + addr1: 'test', + city: 'test', + state: 'test', + zip: '123', + }, + FNAME: 'Bob', + LNAME: 'Dole', + ANONYMOUSI: 'userId12345', + BIRTHDAY: '05/06', + }, + email_address: 'bob.dole@initech.com', + status: 'subscribed', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + MailChimp: { + subscriptionStatus: 'subscribed', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + status: 'subscribed', + email_address: 'bob.dole@initech.com', + merge_fields: { + ANONYMOUSI: 'userId12345', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'Titli Test', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + type: 'identify', + sentAt: '2021-05-18T06:58:57.186Z', + userId: 'test.rudderlabs@yara.com', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.18', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'https://app.rudderstack.com/sources/1qHR2Qzd894ievNGc4aBHmjltLD', + path: '/sources/1qHR2Qzd894ievNGc4aBHmjltLD', + title: 'RudderStack', + search: '', + tab_url: 'https://app.rudderstack.com/sources/1qHR2Qzd894ievNGc4aBHmjltLD', + referrer: '$direct', + initial_referrer: 'https://www.google.com/', + referring_domain: '', + initial_referring_domain: 'www.google.com', + }, + locale: 'en-US', + screen: { + width: 1792, + height: 1120, + density: 2, + }, + traits: { + name: 'test rudderlabs', + email: 'test.rudderlabs@yara.com', + userId: '1sWVaQTxoVwjvShC0295E6OqMaP', + first_login: false, + workspaceId: '1jWrHYPjNGSHbvKwzow0ZFPIQll', + account_type: 'invited', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.18', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36', + }, + rudderId: '6d612dda-9c8c-4062-9d09-af9425b846ce', + messageId: 'c6d49688-89f2-45cf-b061-0ae3c212a4e5', + timestamp: '2021-05-18T06:58:57.811Z', + receivedAt: '2021-05-18T06:58:57.812Z', + request_ip: '122.172.221.51', + anonymousId: '6914679f-fd34-45ef-86e0-4930e6e8b91a', + integrations: { + Salesforce: true, + }, + originalTimestamp: '2021-05-18T06:58:57.185Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'User does not have access to the requested operation', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'network', + errorType: 'aborted', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'Titli Test', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + type: 'page', + sentAt: '2021-05-18T07:02:17.675Z', + userId: '', + channel: 'web', + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.18', + namespace: 'com.rudderlabs.javascript', + }, + page: { + url: 'https://app.rudderstack.com/signup?type=freetrial', + path: '/signup', + title: '', + search: '?type=freetrial', + tab_url: 'https://app.rudderstack.com/signup?type=freetrial', + referrer: + 'https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e', + initial_referrer: + 'https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e', + referring_domain: 'rudderstack.medium.com', + initial_referring_domain: 'rudderstack.medium.com', + }, + locale: 'en-GB', + screen: { + density: 2, + }, + traits: {}, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.18', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36', + }, + rudderId: '4dbe224c-6aea-4d89-8da6-09d27c0d2908', + messageId: '72df8cb0-54ab-417c-8e87-e97e9d339feb', + timestamp: '2021-05-18T07:02:18.566Z', + properties: { + url: 'https://app.rudderstack.com/signup?type=freetrial', + path: '/signup', + title: '', + search: '?type=freetrial', + tab_url: 'https://app.rudderstack.com/signup?type=freetrial', + referrer: + 'https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e', + initial_referrer: + 'https://rudderstack.medium.com/kafka-vs-postgresql-how-we-implemented-our-queueing-system-using-postgresql-ec128650e3e', + referring_domain: 'rudderstack.medium.com', + initial_referring_domain: 'rudderstack.medium.com', + }, + receivedAt: '2021-05-18T07:02:18.566Z', + request_ip: '162.44.150.11', + anonymousId: '58ec7b39-48f1-4d83-9d45-a48c64f96fa0', + integrations: { + All: true, + }, + originalTimestamp: '2021-05-18T07:02:17.675Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'message type page is not supported', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + mappedToDestination: true, + externalId: [ + { + identifierType: 'email_address', + id: 'bob.dole@initech.com', + type: 'audience', + }, + ], + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + traits: { + merge_fields: { + FIRSTNAME: 'Bob', + }, + status: 'subscribed', + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + merge_fields: { + FIRSTNAME: 'Bob', + }, + status: 'subscribed', + email_address: 'bob.dole@initech.com', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + type: 'identify', + traits: { + status: 'subscri', + }, + userId: 'emrichardson820+22822@gmail.com', + channel: 'sources', + context: { + sources: { + job_id: '24c5HJxHomh6YCngEOCgjS5r1KX/Syncher', + task_id: 'vw_rs_mailchimp_mocked_hg_data', + version: 'v1.8.1', + batch_id: 'f252c69d-c40d-450e-bcd2-2cf26cb62762', + job_run_id: 'c8el40l6e87v0c4hkbl0', + task_run_id: 'c8el40l6e87v0c4hkblg', + }, + externalId: [ + { + id: 'emrichardson820+22822@gmail.com', + type: 'MAILCHIMP-92e1f1ad2c', + identifierType: 'email_address', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a', + messageId: 'b3bee036-fc26-4f6d-9867-c17f85708a82', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Email is required for identify', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud112', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'jhon@gmail.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + XML: {}, + FORM: {}, + JSON: { + status: 'subscribed', + email_address: 'jhon@gmail.com', + }, + JSON_ARRAY: {}, + }, + type: 'REST', + files: {}, + method: 'PUT', + params: {}, + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + audienceId: 'aud112', + version: '1', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud112/members/7f3863b197eeff650876bb89eca08e57', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'bob.dole@initech.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + XML: {}, + FORM: {}, + JSON: { + email_address: 'bob.dole@initech.com', + status: 'subscribed', + }, + JSON_ARRAY: {}, + }, + type: 'REST', + files: {}, + method: 'PUT', + params: {}, + audienceId: 'aud111', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + version: '1', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + MailChimp: { + subscriptionStatus: 'subscribed', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + status: 'subscribed', + email_address: 'bob.dole@initech.com', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: '', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'test-rudderlabs', + email: 'test-rudderlabs-test@initech.com', + firstName: 'Test', + lastName: 'Rudderlabs', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'API Key not found. Aborting', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 11', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'test-rudderlabs', + email: 'test-rudderlabs-test@initech.com', + firstName: 'Test', + lastName: 'Rudderlabs', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Audience Id not found. Aborting', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 12', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: '', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'test-rudderlabs', + email: 'test-rudderlabs-test@initech.com', + firstName: 'Test', + lastName: 'Rudderlabs', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'DataCenter Id not found. Aborting', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 13', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'test-rudderlabs', + email: 'test-rudderlabs-test@initech.com', + firstName: 'Test', + lastName: 'Rudderlabs', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'group', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'message type group is not supported', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 14', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + properties: { + brand: 'Aster', + product: 'Garments', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 15', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + is_syncing: false, + properties: { + brand: 'Aster', + product: 'Garments', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 16', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Email is required for track', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 17', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Missing required value from "event"', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 18', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 19', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + products: [ + { + product_id: '123', + price: '14', + }, + { + product_id: '123', + price: 14, + }, + ], + purchased: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + is_syncing: false, + properties: { + brand: 'Aster', + product: 'Garments', + products: '[{"product_id":"123","price":"14"},{"product_id":"123","price":14}]', + purchased: 'false', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 20', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + products: [ + { + product_id: '123', + price: '14', + }, + { + product_id: '123', + price: 14, + }, + ], + purchased: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 22, + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmR1bW15QXBpS2V5', + }, + params: {}, + body: { + JSON: { + name: '22', + occurred_at: '2019-11-15T10:26:53+00:00', + is_syncing: false, + properties: { + brand: 'Aster', + product: 'Garments', + products: '[{"product_id":"123","price":"14"},{"product_id":"123","price":14}]', + purchased: 'false', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 21', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + products: [ + { + product_id: '123', + price: '14', + }, + { + product_id: '123', + price: 14, + }, + ], + purchased: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'E', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event name should be between 2 and 30 characters', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'mailchimp', + description: 'Test 22', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'dummyApiKey', + audienceId: 'aud111', + datacenterId: 'usXX', + }, + Enabled: true, + Transformations: [], + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + products: [ + { + product_id: '123', + price: '14', + }, + { + product_id: '123', + price: 14, + }, + ], + purchased: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'Event Name more than 30 characters abcdefghijklmno', + userId: 'userId12345', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event name should be between 2 and 30 characters', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/mailchimp/router/data.ts b/test/integrations/destinations/mailchimp/router/data.ts new file mode 100644 index 0000000000..f6a9627719 --- /dev/null +++ b/test/integrations/destinations/mailchimp/router/data.ts @@ -0,0 +1,977 @@ +export const data = [ + { + name: 'mailchimp', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 2, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + firstName: 'Bob', + lastName: 'Dole', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 3, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + MailChimp: { + subscriptionStatus: 'subscribed', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 4, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + MailChimp: { + subscriptionStatus: 'subscrib', + }, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 5, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 6, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + is_syncing: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 7, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + traits: { + anonymousId: 'userId12345', + email: 'bob.dole@initech.com', + }, + }, + properties: { + brand: 'Aster', + product: 'Garments', + isSyncing: false, + products: [ + { + product_id: '123', + price: '14', + }, + { + product_id: '123', + price: 14, + }, + ], + purchased: false, + }, + messageId: '6d1f3ca8-e2d0-4d34-9926-44596171af0c', + originalTimestamp: '2019-11-15T10:26:53Z', + receivedAt: '2019-11-15T15:56:58+05:30', + sentAt: '2019-11-15T10:26:58Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:56:53+05:30', + type: 'track', + event: 'local testing', + userId: 'userId12345', + }, + }, + ], + destType: 'mailchimp', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111?skip_merge_validation=true&skip_duplicate_check=false', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmFwaWtleQ==', + }, + params: {}, + body: { + JSON: { + members: [ + { + email_address: 'bob.dole@initech.com', + merge_fields: { + FNAME: 'Bob', + LNAME: 'Dole', + ANONYMOUSI: 'userId12345', + }, + status: 'subscribed', + }, + { + email_address: 'bob.dole@initech.com', + merge_fields: { + ANONYMOUSI: 'userId12345', + }, + status: 'subscribed', + }, + ], + update_existing: true, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 2, + }, + { + jobId: 3, + }, + ], + batched: true, + statusCode: 200, + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmFwaWtleQ==', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + properties: { + brand: 'Aster', + product: 'Garments', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + }, + metadata: [ + { + jobId: 5, + }, + ], + batched: false, + statusCode: 200, + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://usXX.api.mailchimp.com/3.0/lists/aud111/members/48cd6232dc124497369f59c33d3eb4ab/events', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmFwaWtleQ==', + }, + params: {}, + body: { + JSON: { + name: 'local_testing', + occurred_at: '2019-11-15T10:26:53+00:00', + is_syncing: false, + properties: { + brand: 'Aster', + product: 'Garments', + products: + '[{"product_id":"123","price":"14"},{"product_id":"123","price":14}]', + purchased: 'false', + }, + }, + XML: {}, + JSON_ARRAY: {}, + FORM: {}, + }, + files: {}, + audienceId: 'aud111', + }, + metadata: [ + { + jobId: 7, + }, + ], + batched: false, + statusCode: 200, + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: [ + { + jobId: 6, + }, + ], + batched: false, + statusCode: 400, + error: 'Missing required value from "event"', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apikey', + audienceId: 'aud111', + datacenterId: 'usXX', + enableMergeFields: true, + }, + Enabled: true, + Transformations: [], + }, + metadata: [ + { + jobId: 4, + }, + ], + batched: false, + statusCode: 400, + error: + 'The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + }, + ], + }, + }, + }, + }, + { + name: 'mailchimp', + description: 'events batching', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 2, + }, + message: { + anonymousId: 'userId12345', + channel: 'web', + context: { + mappedToDestination: true, + externalId: [ + { + identifierType: 'email_address', + id: 'bob.dole@initech.com', + type: 'audience', + }, + ], + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + ip: '0.0.0.0', + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.0.0', + }, + locale: 'en-US', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36', + }, + integrations: { + All: true, + }, + traits: { + merge_fields: { + FIRSTNAME: 'Bob', + }, + status: 'subscribed', + }, + messageId: '21e475b2-3694-477b-afb6-5b94a81aac21', + originalTimestamp: '2019-11-15T10:22:32Z', + receivedAt: '2019-11-15T15:52:37+05:30', + request_ip: '[::1]:62921', + sentAt: '2019-11-15T10:22:37Z', + source_id: '1TdhTcwsUVOeEMWyPUpQIgF3pYr', + timestamp: '2019-11-15T15:52:32+05:30', + type: 'identify', + userId: 'userId12345', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 3, + }, + message: { + type: 'identify', + traits: { + status: 'subscribed', + }, + userId: 'emrichardson820+22822@gmail.com', + channel: 'sources', + context: { + sources: { + job_id: '24c5HJxHomh6YCngEOCgjS5r1KX/Syncher', + task_id: 'vw_rs_mailchimp_mocked_hg_data', + version: 'v1.8.1', + batch_id: 'f252c69d-c40d-450e-bcd2-2cf26cb62762', + job_run_id: 'c8el40l6e87v0c4hkbl0', + task_run_id: 'c8el40l6e87v0c4hkblg', + }, + externalId: [ + { + id: 'emrichardson820+22822@gmail.com', + type: 'MAILCHIMP-92e1f1ad2c', + identifierType: 'email_address', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a', + messageId: 'b3bee036-fc26-4f6d-9867-c17f85708a82', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 4, + }, + message: { + type: 'identify', + traits: { + status: 'subscribed', + }, + userId: 'emrichardson820+22822@gmail.com', + channel: 'sources', + context: { + sources: { + job_id: '24c5HJxHomh6YCngEOCgjS5r1KX/Syncher', + task_id: 'vw_rs_mailchimp_mocked_hg_data', + version: 'v1.8.1', + batch_id: 'f252c69d-c40d-450e-bcd2-2cf26cb62762', + job_run_id: 'c8el40l6e87v0c4hkbl0', + task_run_id: 'c8el40l6e87v0c4hkblg', + }, + externalId: [ + { + id: 'emrichardson820+22822@gmail.com', + type: 'MAILCHIMP-92e1f1ad2c', + identifierType: 'email_address', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a', + messageId: 'b3bee036-fc26-4f6d-9867-c17f85708a82', + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + metadata: { + jobId: 5, + }, + message: { + type: 'identify', + traits: { + status: 'subscrib', + }, + userId: 'emrichardson820+22822@gmail.com', + channel: 'sources', + context: { + sources: { + job_id: '24c5HJxHomh6YCngEOCgjS5r1KX/Syncher', + task_id: 'vw_rs_mailchimp_mocked_hg_data', + version: 'v1.8.1', + batch_id: 'f252c69d-c40d-450e-bcd2-2cf26cb62762', + job_run_id: 'c8el40l6e87v0c4hkbl0', + task_run_id: 'c8el40l6e87v0c4hkblg', + }, + externalId: [ + { + id: 'emrichardson820+22822@gmail.com', + type: 'MAILCHIMP-92e1f1ad2c', + identifierType: 'email_address', + }, + ], + mappedToDestination: 'true', + }, + recordId: '1', + rudderId: '4d5d0ed0-9db8-41cc-9bb0-a032f6bfa97a', + messageId: 'b3bee036-fc26-4f6d-9867-c17f85708a82', + }, + }, + ], + destType: 'mailchimp', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: + 'https://us20.api.mailchimp.com/3.0/lists/1232yyqw22?skip_merge_validation=false&skip_duplicate_check=false', + headers: { + 'Content-Type': 'application/json', + Authorization: 'Basic YXBpS2V5OmFwaUtleS1kdW1teUFwaUtleQ==', + }, + params: {}, + body: { + JSON: { + members: [ + { + merge_fields: { + FIRSTNAME: 'Bob', + }, + status: 'subscribed', + email_address: 'bob.dole@initech.com', + }, + { + status: 'subscribed', + email_address: 'emrichardson820+22822@gmail.com', + }, + { + status: 'subscribed', + email_address: 'emrichardson820+22822@gmail.com', + }, + ], + update_existing: true, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 2, + }, + { + jobId: 3, + }, + { + jobId: 4, + }, + ], + batched: true, + statusCode: 200, + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + }, + { + destination: { + ID: '1Tdi0lpXwSVwXG1lcdP2pXHKrJ6', + Name: 'test-mc', + DestinationDefinition: { + ID: '1SujZGrVEPqYmpUJcV4vSl9tfxn', + Name: 'MC', + DisplayName: 'MailChimp', + }, + Config: { + apiKey: 'apiKey-dummyApiKey', + audienceId: '1232yyqw22', + datacenterId: 'us20', + }, + Enabled: true, + Transformations: [], + }, + metadata: [ + { + jobId: 5, + }, + ], + batched: false, + statusCode: 400, + error: + 'The status must be one of [subscribed, unsubscribed, cleaned, pending, transactional]', + statTags: { + destType: 'MAILCHIMP', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/monday/network.ts b/test/integrations/destinations/monday/network.ts new file mode 100644 index 0000000000..f23b9061f8 --- /dev/null +++ b/test/integrations/destinations/monday/network.ts @@ -0,0 +1,242 @@ +export const networkCallsData = [ + { + httpReq: { + url: 'https://api.monday.com/v2', + method: 'POST', + headers: { + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + }, + }, + httpRes: { + data: { + data: { + boards: [ + { + name: 'Planning', + columns: [ + { + id: 'name', + title: 'Name', + type: 'name', + description: null, + settings_str: '{}', + }, + { + id: 'subitems', + title: 'Subitems', + type: 'subtasks', + description: null, + settings_str: + '{"allowMultipleItems":true,"itemTypeName":"column.subtasks.title","displayType":"BOARD_INLINE","boardIds":[3160974974]}', + }, + { + id: 'person', + title: 'Person', + type: 'multiple-person', + description: null, + settings_str: '{}', + }, + { + id: 'status', + title: 'Status', + type: 'color', + description: null, + settings_str: + '{"labels":{"0":"Working on it","1":"Done","2":"Stuck"},"labels_positions_v2":{"0":0,"1":2,"2":1,"5":3},"labels_colors":{"0":{"color":"#fdab3d","border":"#E99729","var_name":"orange"},"1":{"color":"#00c875","border":"#00B461","var_name":"green-shadow"},"2":{"color":"#e2445c","border":"#CE3048","var_name":"red-shadow"}}}', + }, + { + id: 'date4', + title: 'Date', + type: 'date', + description: null, + settings_str: '{}', + }, + { + id: 'checkbox', + title: 'Checkbox', + type: 'boolean', + description: null, + settings_str: '{}', + }, + { + id: 'connect_boards', + title: 'Connect boards', + type: 'board-relation', + description: null, + settings_str: '{"allowCreateReflectionColumn":false}', + }, + { + id: 'status_1', + title: 'Other', + type: 'color', + description: null, + settings_str: + '{"labels":{"0":"Working on it","1":"Done","2":"Stuck"},"labels_colors":{"0":{"color":"#fdab3d","border":"#E99729","var_name":"orange"},"1":{"color":"#00c875","border":"#00B461","var_name":"green-shadow"},"2":{"color":"#e2445c","border":"#CE3048","var_name":"red-shadow"}}}', + }, + { + id: 'date_1', + title: 'Date 1', + type: 'date', + description: null, + settings_str: '{"hide_footer":false}', + }, + { + id: 'status_12', + title: 'new status', + type: 'color', + description: null, + settings_str: + '{"labels":{"0":"Working on it","1":"Done","2":"Stuck"},"labels_colors":{"0":{"color":"#fdab3d","border":"#E99729","var_name":"orange"},"1":{"color":"#00c875","border":"#00B461","var_name":"green-shadow"},"2":{"color":"#e2445c","border":"#CE3048","var_name":"red-shadow"}}}', + }, + { + id: 'numbers', + title: 'Numbers', + type: 'numeric', + description: null, + settings_str: '{}', + }, + { + id: 'text', + title: 'Name', + type: 'text', + description: null, + settings_str: '{}', + }, + { + id: 'country', + title: 'Country', + type: 'country', + description: null, + settings_str: '{}', + }, + { + id: 'dropdown', + title: 'Dropdown', + type: 'dropdown', + description: null, + settings_str: + '{"hide_footer":false,"labels":[{"id":1,"name":"dropdown"},{"id":2,"name":"dropup"}]}', + }, + { + id: 'email', + title: 'Email', + type: 'email', + description: null, + settings_str: '{}', + }, + { + id: 'location', + title: 'Location', + type: 'location', + description: null, + settings_str: '{}', + }, + { + id: 'phone', + title: 'Phone', + type: 'phone', + description: null, + settings_str: '{}', + }, + { + id: 'rating', + title: 'Rating', + type: 'rating', + description: null, + settings_str: '{}', + }, + { + id: 'timeline', + title: 'Timeline', + type: 'timerange', + description: null, + settings_str: '{"hide_footer":false}', + }, + { + id: 'dependent_on', + title: 'Dependent On', + type: 'dependency', + description: + 'Choose the item your task will be dependent on. If the “dependent on” item’s date is changing, the other dates will adjust automatically', + settings_str: + '{"boardIds":[3142482015],"dependencyNewInfra":true,"allowMultipleItems":true}', + }, + { + id: 'long_text', + title: 'Long Text', + type: 'long-text', + description: null, + settings_str: '{}', + }, + { + id: 'link', + title: 'Link', + type: 'link', + description: null, + settings_str: '{}', + }, + { + id: 'tags', + title: 'Tags', + type: 'tag', + description: null, + settings_str: '{"hide_footer":false}', + }, + { + id: 'label', + title: 'Label', + type: 'color', + description: '', + settings_str: + '{"done_colors":[1],"labels":{"3":"Label 2","105":"Label 1","156":"Label 3"},"labels_positions_v2":{"3":1,"5":3,"105":0,"156":2},"labels_colors":{"3":{"color":"#0086c0","border":"#3DB0DF","var_name":"blue-links"},"105":{"color":"#9AADBD","border":"#9AADBD","var_name":"winter"},"156":{"color":"#9D99B9","border":"#9D99B9","var_name":"purple_gray"}}}', + }, + { + id: 'world_clock', + title: 'World Clock', + type: 'timezone', + description: null, + settings_str: '{}', + }, + { + id: 'week', + title: 'Week', + type: 'week', + description: null, + settings_str: '{}', + }, + ], + groups: [ + { + id: 'topics', + title: 'This month', + }, + { + id: 'group_title', + title: 'Next month', + }, + ], + }, + ], + }, + account_id: 13215538, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.monday.com/v2', + method: 'POST', + headers: { + Authorization: 'failedApiToken', + }, + }, + httpRes: { + data: { + boards: [], + }, + status: 200, + }, + }, +]; diff --git a/test/integrations/destinations/monday/processor/data.ts b/test/integrations/destinations/monday/processor/data.ts new file mode 100644 index 0000000000..4e5280efcb --- /dev/null +++ b/test/integrations/destinations/monday/processor/data.ts @@ -0,0 +1,1399 @@ +export const data = [ + { + name: 'monday', + description: 'Track call with empty columnToPropertyMapping', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + query: + 'mutation { create_item (board_id: 339283933, item_name: "Task 1", column_values: "{}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.monday.com/v2', + files: {}, + headers: { + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + 'Content-Type': 'application/json', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Track call with undefined columnToPropertyMapping', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + query: + 'mutation { create_item (board_id: 339283933, item_name: "Task 1", column_values: "{}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.monday.com/v2', + files: {}, + headers: { + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + 'Content-Type': 'application/json', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Check Unsupported message type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event type identify is not supported', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Check for empty message type', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: '', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event type is required', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Check for empty API Token', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: '', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'ApiToken is a required field', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Check for empty board Id', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'boardId is a required field', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Check for event name', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: '', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event is a required field and should be a string', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Track call with columnToPropertyMapping and with empty groupTitle', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.monday.com/v2', + headers: { + 'Content-Type': 'application/json', + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + }, + params: {}, + body: { + JSON: { + query: + 'mutation { create_item (board_id: 339283933, item_name: "Task 1", column_values: "{\\"status\\":{\\"label\\":\\"Done\\"},\\"email\\":{\\"email\\":\\"abc@email.com\\",\\"text\\":\\"emailId\\"}}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Track call with columnToPropertyMapping and with groupTitle', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.monday.com/v2', + headers: { + 'Content-Type': 'application/json', + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + }, + params: {}, + body: { + JSON: { + query: + 'mutation { create_item (board_id: 339283933, group_id: group_title item_name: "Task 1", column_values: "{\\"status\\":{\\"label\\":\\"Done\\"},\\"email\\":{\\"email\\":\\"abc@email.com\\",\\"text\\":\\"emailId\\"}}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'Non-existing group title check', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next year', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: "Group Next year doesn't exist in the board", + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'check for item name', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: '', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Item name is required to create an item', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: + 'Track call with columnToPropertyMapping and with groupTitle with all supported columns', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + { + from: 'Checkbox', + to: 'checked', + }, + { + from: 'Numbers', + to: 'number', + }, + { + from: 'Name', + to: 'textKey', + }, + { + from: 'Country', + to: 'countryName', + }, + { + from: 'Location', + to: 'address', + }, + { + from: 'Phone', + to: 'phone', + }, + { + from: 'Rating', + to: 'rating', + }, + { + from: 'Link', + to: 'url', + }, + { + from: 'Long Text', + to: 'description', + }, + { + from: 'World Clock', + to: 'timezone', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + countryCode: 'US', + latitude: '51.23', + longitude: '35.3', + rating: '3', + linkText: 'websiteLink', + checked: 'true', + number: '45', + textKey: 'texting', + countryName: 'Unites States', + countryShortName: 'US', + address: 'New York', + phone: '2626277272', + url: 'demo.com', + description: 'property description', + timezone: 'America/New_York', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.monday.com/v2', + headers: { + 'Content-Type': 'application/json', + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + }, + params: {}, + body: { + JSON: { + query: + 'mutation { create_item (board_id: 339283933, group_id: group_title item_name: "Task 1", column_values: "{\\"status\\":{\\"label\\":\\"Done\\"},\\"email\\":{\\"email\\":\\"abc@email.com\\",\\"text\\":\\"emailId\\"},\\"checkbox\\":{\\"checked\\":true},\\"numbers\\":\\"45\\",\\"text\\":\\"texting\\",\\"country\\":{\\"countryName\\":\\"Unites States\\",\\"countryCode\\":\\"US\\"},\\"location\\":{\\"address\\":\\"New York\\",\\"lat\\":\\"51.23\\",\\"lng\\":\\"35.3\\"},\\"phone\\":{\\"phone\\":\\"2626277272\\",\\"countryShortName\\":\\"US\\"},\\"rating\\":3,\\"link\\":{\\"url\\":\\"demo.com\\",\\"text\\":\\"websiteLink\\"},\\"long_text\\":{\\"text\\":\\"property description\\"},\\"world_clock\\":{\\"timezone\\":\\"America/New_York\\"}}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'check for allowed event name from UI', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: '', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: '', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event Discarded. To allow this event, add this in Allowlist', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'monday', + description: 'check for deleted boards (configured boards are deleted)', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + apiToken: 'failedApiToken', + boardId: '339283934', + groupTitle: 'Next year', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { + from: 'Email', + to: 'emailId', + }, + ], + whitelistedEvents: [ + { + eventName: 'create an item', + }, + ], + }, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'The board with boardId 339283934 does not exist', + statTags: { + destType: 'MONDAY', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/monday/router/data.ts b/test/integrations/destinations/monday/router/data.ts new file mode 100644 index 0000000000..eefc106274 --- /dev/null +++ b/test/integrations/destinations/monday/router/data.ts @@ -0,0 +1,228 @@ +export const data = [ + { + name: 'monday', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [{ eventName: 'create an item' }], + }, + }, + metadata: { + jobId: 1, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + { + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { from: 'Email', to: 'emailId' }, + ], + whitelistedEvents: [{ eventName: 'create an item' }], + }, + }, + metadata: { + jobId: 2, + }, + message: { + event: 'create an item', + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + userId: 'user@27', + channel: 'web', + properties: { + name: 'Task 1', + status: 'Done', + emailId: 'abc@email.com', + emailText: 'emailId', + }, + context: { + os: { + name: '', + version: '', + }, + app: { + name: 'RudderLabs JavaScript SDK', + build: '1.0.0', + version: '1.1.11', + namespace: 'com.rudderlabs.javascript', + }, + locale: 'en-US', + screen: { + density: 2, + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.11', + }, + campaign: {}, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0', + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + }, + ], + destType: 'monday', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + body: { + FORM: {}, + JSON: { + query: + 'mutation { create_item (board_id: 339283933, item_name: "Task 1", column_values: "{}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.monday.com/v2', + files: {}, + headers: { + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + 'Content-Type': 'application/json', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + metadata: [ + { + jobId: 1, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: '', + columnToPropertyMapping: [], + whitelistedEvents: [{ eventName: 'create an item' }], + }, + }, + }, + { + batchedRequest: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.monday.com/v2', + headers: { + 'Content-Type': 'application/json', + Authorization: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + }, + params: {}, + body: { + JSON: { + query: + 'mutation { create_item (board_id: 339283933, group_id: group_title item_name: "Task 1", column_values: "{\\"status\\":{\\"label\\":\\"Done\\"},\\"email\\":{\\"email\\":\\"abc@email.com\\",\\"text\\":\\"emailId\\"}}") {id}}', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + }, + metadata: [ + { + jobId: 2, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + apiToken: + 'eywwakzdjiksjhriherniSFsjhnskdojsSDFhsdns.sSRSSREWdnfnsjshfjsjskshfiskskdS__Fskilhih', + boardId: '339283933', + groupTitle: 'Next month', + columnToPropertyMapping: [ + { + from: 'Status', + to: 'status', + }, + { from: 'Email', to: 'emailId' }, + ], + whitelistedEvents: [{ eventName: 'create an item' }], + }, + }, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/profitwell/network.ts b/test/integrations/destinations/profitwell/network.ts new file mode 100644 index 0000000000..e4e7247c74 --- /dev/null +++ b/test/integrations/destinations/profitwell/network.ts @@ -0,0 +1,94 @@ +export const networkCallsData = [ + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/pwu_Oea7HXV3bnTP/', + method: 'GET', + }, + httpRes: { + data: [ + { + user_id: 'pwu_Oea7HXV3bnTP', + subscription_id: 'pws_FecTCEyo17rV', + user_alias: 'spiderman_1a', + subscription_alias: 'spiderman_sub_1a', + email: 'spiderman@profitwell.com', + plan_id: 'web_plan', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: 5000, + effective_date: 1514764800, + meta: {}, + }, + ], + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/spiderman_1a/', + method: 'GET', + }, + httpRes: { + data: [ + { + user_id: 'pwu_Oea7HXV3bnTP', + subscription_id: 'pws_FecTCEyo17rV', + user_alias: 'spiderman_1a', + subscription_alias: 'spiderman_sub_1a', + email: 'spiderman@profitwell.com', + plan_id: 'web_plan', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: 5000, + effective_date: 1514764800, + meta: {}, + }, + ], + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/23453/', + method: 'GET', + }, + httpRes: { + status: 404, + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/sp_245/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/1234/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/samual/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, +]; diff --git a/test/integrations/destinations/profitwell/processor/data.ts b/test/integrations/destinations/profitwell/processor/data.ts new file mode 100644 index 0000000000..58bd2ed35f --- /dev/null +++ b/test/integrations/destinations/profitwell/processor/data.ts @@ -0,0 +1,1241 @@ +export const data = [ + { + name: 'profitwell', + description: 'Test 0', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'userId or userAlias is required for identify', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 1', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + context: { + externalId: [ + { + type: 'profitwellUserId', + id: '23453', + }, + ], + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'No user found for profitwell user_id', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 2', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.profitwell.com/v2/subscriptions/', + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + params: {}, + body: { + JSON: { + subscription_alias: 'samual', + email: 'sample@sample.com', + plan_id: '23', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: '23', + user_alias: 'sp_245', + effective_date: 1630917906, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 3', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'subscriptionId or subscriptionAlias is required for identify', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 4', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: '1234', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'No user found for profitwell user_id', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 5', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.profitwell.com/v2/subscriptions/', + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + params: {}, + body: { + JSON: { + subscription_alias: 'samual', + email: 'sample@sample.com', + plan_id: '23', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: '23', + user_id: 'pwu_Oea7HXV3bnTP', + user_alias: 'sp_245', + effective_date: 1630917906, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 6', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17rV', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'Missing required value from ["traits.effectiveDate","context.traits.effectiveDate"]', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 7', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17rV', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + effectiveDate: '1609748705', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: 'https://api.profitwell.com/v2/subscriptions/pws_FecTCEyo17rV/', + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + params: {}, + body: { + JSON: { + plan_id: '23', + plan_interval: 'month', + value: '23', + status: 'active', + effective_date: 1609748705, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 8', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17rV', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'monthly', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + effectiveDate: '1609748705', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'invalid format for planInterval. Aborting', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 9', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17rV', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'activate', + effectiveDate: '1609748705', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'PUT', + endpoint: 'https://api.profitwell.com/v2/subscriptions/pws_FecTCEyo17rV/', + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + params: {}, + body: { + JSON: { + plan_id: '23', + plan_interval: 'month', + value: '23', + effective_date: 1609748705, + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 10', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: {}, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17rV', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + effectiveDate: '1609748705', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Private API Key not found. Aborting.', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'dataValidation', + errorType: 'configuration', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 11', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + externalId: [ + { + type: 'profitwellUserId', + id: 'pwu_Oea7HXV3bnTP', + }, + { + type: 'profitwellSubscriptionId', + id: 'pws_FecTCEyo17', + }, + ], + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + effectiveDate: '1609748705', + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Profitwell subscription_id not found', + statTags: { + destType: 'PROFITWELL', + errorCategory: 'network', + errorType: 'aborted', + feature: 'processor', + implementation: 'native', + meta: 'instrumentation', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'profitwell', + description: 'Test 12', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + message: { + channel: 'web', + userId: 'sp_245', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.1.9', + }, + library: { + name: 'RudderLabs JavaScript SDK', + version: '1.1.9', + }, + locale: 'en-GB', + os: { + name: '', + version: '', + }, + screen: { + density: 2, + }, + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + effectiveDate: 1609748705, + }, + userAgent: + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', + }, + messageId: '6a5f38c0-4e75-4268-a066-2b73fbcad01f', + originalTimestamp: '2021-01-04T08:25:04.780Z', + receivedAt: '2021-01-04T13:55:04.799+05:30', + request_ip: '[::1]', + rudderId: '79881a62-980a-4d76-89ca-7099440f8c13', + sentAt: '2021-01-04T08:25:04.781Z', + timestamp: '2021-09-06T14:15:06.798+05:30', + type: 'identify', + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + version: '1', + type: 'REST', + method: 'POST', + endpoint: 'https://api.profitwell.com/v2/subscriptions/', + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + params: {}, + body: { + JSON: { + subscription_alias: 'samual', + email: 'sample@sample.com', + plan_id: '23', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: '23', + effective_date: 1609748705, + user_alias: 'sp_245', + }, + JSON_ARRAY: {}, + XML: {}, + FORM: {}, + }, + files: {}, + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/profitwell/router/data.ts b/test/integrations/destinations/profitwell/router/data.ts new file mode 100644 index 0000000000..11f08c2139 --- /dev/null +++ b/test/integrations/destinations/profitwell/router/data.ts @@ -0,0 +1,113 @@ +export const data = [ + { + name: 'profitwell', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + metadata: { + jobId: 2, + }, + message: { + channel: 'web', + context: { + app: { + build: '1.0.0', + name: 'RudderLabs JavaScript SDK', + namespace: 'com.rudderlabs.javascript', + version: '1.0.0', + }, + library: { name: 'RudderLabs JavaScript SDK', version: '1.0.0' }, + 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', + locale: 'en-US', + ip: '0.0.0.0', + os: { name: '', version: '' }, + screen: { density: 2 }, + }, + messageId: '84e26acc-56a5-4835-8233-591137fca468', + session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', + originalTimestamp: '2019-10-14T09:03:17.562Z', + type: 'identify', + userId: 'samual', + traits: { + email: 'sample@sample.com', + planId: '23', + planInterval: 'month', + planCurrency: 'usd', + value: '23', + subscriptionAlias: 'samual', + status: 'active', + }, + integrations: { All: true }, + sentAt: '2019-10-14T09:03:22.563Z', + }, + }, + ], + destType: 'profitwell', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batchedRequest: { + body: { + XML: {}, + FORM: {}, + JSON: { + subscription_alias: 'samual', + email: 'sample@sample.com', + plan_id: '23', + plan_interval: 'month', + plan_currency: 'usd', + status: 'active', + value: '23', + user_alias: 'samual', + effective_date: 1571043797, + }, + JSON_ARRAY: {}, + }, + type: 'REST', + files: {}, + method: 'POST', + params: {}, + headers: { + 'Content-Type': 'application/json', + Authorization: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + version: '1', + endpoint: 'https://api.profitwell.com/v2/subscriptions/', + }, + metadata: [ + { + jobId: 2, + }, + ], + batched: false, + statusCode: 200, + destination: { + Config: { + privateApiKey: '9270161a8e5abaa0e56efddfd9dbcb62', + }, + }, + }, + ], + }, + }, + }, + }, +]; diff --git a/test/integrations/destinations/sendinblue/network.ts b/test/integrations/destinations/sendinblue/network.ts new file mode 100644 index 0000000000..f4f7e84fa7 --- /dev/null +++ b/test/integrations/destinations/sendinblue/network.ts @@ -0,0 +1,92 @@ +export const networkCallsData = [ + { + httpReq: { + url: 'https://api.sendinblue.com/v3/contacts/gordon_pittman%40example.com', + method: 'GET', + }, + httpRes: { + data: { + email: 'gordon_pittman@example.com', + id: 42, + emailBlacklisted: false, + smsBlacklisted: false, + createdAt: '2022-12-04T18:22:48.384+05:30', + modifiedAt: '2022-12-18T14:06:20.515+05:30', + attributes: { + LASTNAME: 'Pittman', + FIRSTNAME: 'Gordon', + AGE: 33, + }, + listIds: [5], + statistics: {}, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.sendinblue.com/v3/contacts/42', + method: 'GET', + }, + httpRes: { + data: { + email: 'gordon_pittman@example.com', + id: 42, + emailBlacklisted: false, + smsBlacklisted: false, + createdAt: '2022-12-04T18:22:48.384+05:30', + modifiedAt: '2022-12-18T14:06:20.515+05:30', + attributes: { + LASTNAME: 'Pittman', + FIRSTNAME: 'Gordon', + AGE: 33, + }, + listIds: [5], + statistics: {}, + }, + status: 200, + }, + }, + { + httpReq: { + url: 'https://api.sendinblue.com/v3/contacts/john_doe%40example.com', + method: 'GET', + }, + httpRes: { + status: 404, + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/sp_245/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/1234/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, + { + httpReq: { + url: 'https://api.profitwell.com/v2/users/samual/', + method: 'GET', + }, + httpRes: { + message: 'Request failed with status code 404', + status: 404, + statusText: 'Not Found', + }, + }, +]; diff --git a/test/integrations/destinations/sendinblue/processor/data.ts b/test/integrations/destinations/sendinblue/processor/data.ts new file mode 100644 index 0000000000..e50bb9c003 --- /dev/null +++ b/test/integrations/destinations/sendinblue/processor/data.ts @@ -0,0 +1,1722 @@ +export const data = [ + { + name: 'sendinblue', + description: 'Page call without email or phone', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'page', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + name: 'New Page', + properties: { + url: 'https://www.google.com/', + title: 'Google home', + }, + context: { + traits: {}, + page: { + url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + path: '/Testing/test/ourSdk.html', + title: 'Document', + search: '', + tab_url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + referrer: 'http://127.0.0.1:7307/Testing/test/', + initial_referrer: '$direct', + referring_domain: '127.0.0.1:7307', + initial_referring_domain: '', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'At least one of `email` or `phone` is required', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Page call', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'page', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + name: 'New Page', + properties: { + url: 'https://www.google.com/', + title: 'Google home', + }, + context: { + traits: { + email: 'john_doe@example.com', + }, + page: { + url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + path: '/Testing/test/ourSdk.html', + title: 'Document', + search: '', + tab_url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + referrer: 'http://127.0.0.1:7307/Testing/test/', + initial_referrer: '$direct', + referring_domain: '127.0.0.1:7307', + initial_referring_domain: '', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: false, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + page: 'https://www.google.com/', + properties: { + ma_path: '/Testing/test/ourSdk.html', + ma_referrer: 'http://127.0.0.1:7307/Testing/test/', + ma_title: 'Google home', + sib_name: 'New Page', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackPage', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track call without email or phone', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: {}, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'At least one of `email` or `phone` is required', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track call without event', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + properties: {}, + context: {}, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Event name is required', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track events with sendTraitsInTrack flag set to true', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: {}, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + sendTraitsInTrack: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + event: 'Order Completed', + eventdata: {}, + properties: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + SMS: '+919876543210', + age: 19, + location: 'Mumbai', + role: 'SDE', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackEvent', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track events with contactAttributeMapping provided in webapp', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: {}, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + sendTraitsInTrack: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + event: 'Order Completed', + eventdata: {}, + properties: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + age: 19, + role: 'SDE', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackEvent', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track events with propertiesIdKey provided in integration object', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: { + orderId: '1341394-3812392190', + products: [ + { + product_id: 1234, + product_name: 'Track Pants', + amount: 1, + price: 220, + }, + { + product_id: 5768, + product_name: 'T-Shirt', + amount: 5, + price: 1058, + }, + ], + }, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + }, + integrations: { + All: true, + sendinblue: { + propertiesIdKey: 'orderId', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + sendTraitsInTrack: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + event: 'Order Completed', + eventdata: { + data: { + orderId: '1341394-3812392190', + products: [ + { + amount: 1, + price: 220, + product_id: 1234, + product_name: 'Track Pants', + }, + { + amount: 5, + price: 1058, + product_id: 5768, + product_name: 'T-Shirt', + }, + ], + }, + id: '1341394-3812392190', + }, + properties: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + age: 19, + role: 'SDE', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackEvent', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track events with eventdata.id taken from messageId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: { + orderId: '1341394-3812392190', + products: [ + { + product_id: 1234, + product_name: 'Track Pants', + amount: 1, + price: 220, + }, + { + product_id: 5768, + product_name: 'T-Shirt', + amount: 5, + price: 1058, + }, + ], + }, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + sendTraitsInTrack: true, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + event: 'Order Completed', + eventdata: { + data: { + orderId: '1341394-3812392190', + products: [ + { + amount: 1, + price: 220, + product_id: 1234, + product_name: 'Track Pants', + }, + { + amount: 5, + price: 1058, + product_id: 5768, + product_name: 'T-Shirt', + }, + ], + }, + id: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + }, + properties: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + age: 19, + role: 'SDE', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackEvent', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track link without email or phone', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'trackLink', + properties: { + link: 'https://www.google.com/gmail/', + emailCount: 19, + }, + context: { + traits: {}, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'At least one of `email` or `phone` is required', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track link without link', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'trackLink', + properties: {}, + context: { + traits: { + phone: '+919507545089', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'Missing required value from "properties.link"', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Track link', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'trackLink', + properties: { + link: 'https://www.google.com/gmail/', + emailCount: 19, + }, + context: { + traits: { + phone: '+919507545089', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + email: '919507545089@mailin-sms.com', + link: 'https://www.google.com/gmail/', + properties: { + emailCount: 19, + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackLink', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call with invalid email', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + email: 'abc.com', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'The provided email is invalid', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call with invalid phone number', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + phone: '99999999', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'The provided phone number is invalid', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to create or update a contact without email or phone', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'At least one of `email` or `phone` is required', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to create or update a contact', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + newEmail: 'alex_root@example.com', + role: 'SDE', + }, + context: { + externalId: [ + { + type: 'sendinblueIncludeListIds', + id: [1, 2], + }, + ], + }, + integrations: { + All: true, + sendinblue: { + emailBlacklisted: true, + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + attributes: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + EMAIL: 'alex_root@example.com', + age: 19, + role: 'SDE', + }, + email: 'john_doe@example.com', + emailBlacklisted: true, + listIds: [1, 2], + updateEnabled: true, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to create DOI contact with templatedId from externalId', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + context: { + externalId: [ + { + type: 'sendinblueIncludeListIds', + id: [1, 2], + }, + { + type: 'sendinblueUnlinkListIds', + id: [5], + }, + { + type: 'sendinblueTemplateId', + id: 2, + }, + ], + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + attributes: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + SMS: '+919876543210', + age: 19, + location: 'Mumbai', + role: 'SDE', + }, + email: 'john_doe@example.com', + includeListIds: [1, 2], + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + templateId: 3, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts/doubleOptinConfirmation', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to create DOI contact without include list Ids', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'sendinblueIncludeListIds is required to create a contact using DOI', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to create DOI contact without template Id', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: 'templateId is required to create a contact using DOI', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to update a DOI contact without an email or contact ID', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'Gordon', + lastName: 'Pittman', + age: 19, + location: 'Mumbai', + role: 'SDE', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'At least one of `email` or `contactId` is required to update the contact using DOI', + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'processor', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: + 'Identify call to update a DOI contact using contactId as an Identifier and without include list Ids', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + age: 36, + location: 'Mumbai', + role: 'SDE 2', + }, + context: { + externalId: [ + { + type: 'sendinblueContactId', + id: 42, + }, + ], + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + attributes: { + age: 36, + location: 'Mumbai', + role: 'SDE 2', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts/42', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'PUT', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: + 'Identify call to update a DOI contact using email as an Identifier and without include list Ids', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + age: 36, + location: 'Mumbai', + role: 'SDE 2', + phone: '+918888888888', + email: 'gordon_pittman@example.com', + newEmail: 'gordon_pittman007@example.com', + }, + context: { + externalId: [ + { + type: 'sendinblueIncludeListIds', + id: [1], + }, + { + type: 'sendinblueUnlinkListIds', + id: [2], + }, + ], + }, + integrations: { + All: true, + sendinblue: { + emailBlacklisted: true, + smsBlacklisted: false, + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + attributes: { + age: 36, + location: 'Mumbai', + role: 'SDE 2', + SMS: '+918888888888', + EMAIL: 'gordon_pittman007@example.com', + }, + emailBlacklisted: true, + smsBlacklisted: false, + listIds: [1], + unlinkListIds: [2], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts/gordon_pittman%40example.com', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'PUT', + params: {}, + type: 'REST', + version: '1', + userId: '', + }, + statusCode: 200, + }, + ], + }, + }, + }, + { + name: 'sendinblue', + description: 'Identify call to unlink a contact from given lists', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + email: 'eric_kim@example.com', + }, + context: { + externalId: [ + { + type: 'sendinblueUnlinkListIds', + id: [2, 5], + }, + ], + }, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + }, + }, + }, + ], + }, + }, + output: { + response: { + status: 200, + body: [ + { + output: { + body: { + FORM: {}, + JSON: { + emails: ['eric_kim@example.com'], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts/lists/2/contacts/remove', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + userId: '', + version: '1', + }, + statusCode: 200, + }, + { + output: { + body: { + FORM: {}, + JSON: { + emails: ['eric_kim@example.com'], + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts/lists/5/contacts/remove', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + userId: '', + version: '1', + }, + statusCode: 200, + }, + ], + }, + }, + }, +]; diff --git a/test/integrations/destinations/sendinblue/router/data.ts b/test/integrations/destinations/sendinblue/router/data.ts new file mode 100644 index 0000000000..31781e4c4f --- /dev/null +++ b/test/integrations/destinations/sendinblue/router/data.ts @@ -0,0 +1,410 @@ +export const data = [ + { + name: 'sendinblue', + description: 'Test 0', + feature: 'router', + module: 'destination', + version: 'v0', + input: { + request: { + body: { + input: [ + { + message: { + type: 'track', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + event: 'Order Completed', + properties: { + orderId: '1341394-3812392190', + products: [ + { + product_id: 1234, + product_name: 'Track Pants', + amount: 1, + price: 220, + }, + { + product_id: 5768, + product_name: 'T-Shirt', + amount: 5, + price: 1058, + }, + ], + }, + context: { + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + metadata: { + jobId: 1, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + sendTraitsInTrack: true, + }, + }, + }, + { + message: { + type: 'page', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + name: 'New Page', + properties: { + url: 'https://www.google.com/', + title: 'Google home', + }, + context: { + traits: { + email: 'john_doe@example.com', + }, + page: { + url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + path: '/Testing/test/ourSdk.html', + title: 'Document', + search: '', + tab_url: 'http://127.0.0.1:7307/Testing/test/ourSdk.html', + referrer: 'http://127.0.0.1:7307/Testing/test/', + initial_referrer: '$direct', + referring_domain: '127.0.0.1:7307', + initial_referring_domain: '', + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + metadata: { + jobId: 2, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: false, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + newEmail: 'alex_root@example.com', + role: 'SDE', + }, + context: { + externalId: [ + { + type: 'sendinblueIncludeListIds', + id: [1, 2], + }, + ], + }, + integrations: { + All: true, + sendinblue: { + emailBlacklisted: true, + }, + }, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + metadata: { + jobId: 3, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + }, + }, + }, + { + message: { + type: 'identify', + sentAt: '2021-01-03T17:02:53.195Z', + channel: 'web', + traits: { + first_name: 'John', + lastName: 'Doe', + age: 19, + email: 'john_doe@example.com', + phone: '+919876543210', + location: 'Mumbai', + role: 'SDE', + }, + context: {}, + rudderId: '8f8fa6b5-8e24-489c-8e22-61f23f2e364f', + messageId: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + anonymousId: '97c46c81-3140-456d-b2a9-690d70aaca35', + originalTimestamp: '2021-01-03T17:02:53.193Z', + }, + metadata: { + jobId: 4, + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + destType: 'sendinblue', + }, + }, + }, + output: { + response: { + status: 200, + body: { + output: [ + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + event: 'Order Completed', + eventdata: { + data: { + orderId: '1341394-3812392190', + products: [ + { + amount: 1, + price: 220, + product_id: 1234, + product_name: 'Track Pants', + }, + { + amount: 5, + price: 1058, + product_id: 5768, + product_name: 'T-Shirt', + }, + ], + }, + id: '2116ef8c-efc3-4ca4-851b-02ee60dad6ff', + }, + properties: { + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + age: 19, + role: 'SDE', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackEvent', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + doi: false, + sendTraitsInTrack: true, + }, + }, + metadata: [ + { + jobId: 1, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + email: 'john_doe@example.com', + page: 'https://www.google.com/', + properties: { + ma_path: '/Testing/test/ourSdk.html', + ma_referrer: 'http://127.0.0.1:7307/Testing/test/', + ma_title: 'Google home', + sib_name: 'New Page', + }, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://in-automate.sendinblue.com/api/v2/trackPage', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'ma-key': 'clientKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + doi: false, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + templateId: 3, + }, + }, + metadata: [ + { + jobId: 2, + }, + ], + statusCode: 200, + }, + { + batched: false, + batchedRequest: { + body: { + FORM: {}, + JSON: { + attributes: { + EMAIL: 'alex_root@example.com', + FIRSTNAME: 'John', + LASTNAME: 'Doe', + LOCATION: 'Mumbai', + SMS: '+919876543210', + age: 19, + role: 'SDE', + }, + email: 'john_doe@example.com', + emailBlacklisted: true, + listIds: [1, 2], + updateEnabled: true, + }, + JSON_ARRAY: {}, + XML: {}, + }, + endpoint: 'https://api.sendinblue.com/v3/contacts', + files: {}, + headers: { + 'Content-Type': 'application/json', + 'api-key': 'apiKey123', + }, + method: 'POST', + params: {}, + type: 'REST', + version: '1', + }, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + contactAttributeMapping: [ + { + from: 'location', + to: 'LOCATION', + }, + ], + doi: false, + }, + }, + metadata: [ + { + jobId: 3, + }, + ], + statusCode: 200, + }, + { + batched: false, + error: 'sendinblueIncludeListIds is required to create a contact using DOI', + metadata: [ + { + jobId: 4, + }, + ], + statTags: { + destType: 'SENDINBLUE', + errorCategory: 'dataValidation', + errorType: 'instrumentation', + feature: 'router', + implementation: 'native', + module: 'destination', + }, + statusCode: 400, + destination: { + Config: { + apiKey: 'apiKey123', + clientKey: 'clientKey123', + templateId: 3, + doi: true, + redirectionUrl: 'https://app.sendinblue.com/marketing-dashboard', + }, + }, + }, + ], + }, + }, + }, + }, +];