Skip to content

Commit

Permalink
chore: added gladly router and processor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 committed Nov 14, 2023
1 parent f8ba709 commit 7186398
Show file tree
Hide file tree
Showing 5 changed files with 1,235 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/gladly/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:
- name: validateInput
template: |
let messageType = $.outputs.messageType
$.assert(messageType, "message Type is not present. Aborting.")
$.assert(messageType, "message Type is not present. Aborting")
$.assert(messageType in {{$.EventType.([.IDENTIFY])}}, "message type " + messageType + " is not supported")
$.assertConfig(.destination.Config.apiToken, "API Token is not present. Aborting")
$.assertConfig(.destination.Config.domain, "Gladly domain is not present. Aborting")
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/gladly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const reservedCustomAttributes = [
'name',
'avatar',
'firstName',
'lstName',
'lastName',
'userId',
];

Expand Down
120 changes: 120 additions & 0 deletions test/integrations/destinations/gladly/network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
const deleteNwData = [
{
httpReq: {
method: 'get',
url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test%40rudderlabs.com',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==',
},
},
httpRes: {
data: [],
status: 200,
},
},
{
httpReq: {
method: 'get',
url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test%2B2%40rudderlabs.com',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==',
},
},
httpRes: {
data: [
{
emails: [
{
normalized: '[email protected]',
original: '[email protected]',
},
],
externalCustomerId: 'externalCustomer@2',
name: 'Test Rudderstack',
phones: [],
id: 'user@2',
},
],
status: 200,
},
},
{
httpReq: {
method: 'get',
url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?phoneNumber=%2B91%209999999988',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==',
},
},
httpRes: {
data: [
{
emails: [
{
normalized: '[email protected]',
original: '[email protected]',
},
],
externalCustomerId: 'externalCustomer@3',
name: 'Test Rudderstack',
phones: [],
id: 'user@3',
},
{
emails: [
{
normalized: '[email protected]',
original: '[email protected]',
},
],
externalCustomerId: 'externalCustomer@4',
name: 'Test Rudderstack',
phones: [],
id: 'user@4',
},
],
status: 200,
},
},
{
httpReq: {
method: 'get',
url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=test6%40rudderlabs.com',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==',
},
},
httpRes: {
data: [],
status: 200,
},
},
{
httpReq: {
method: 'get',
url: 'https://rudderlabs.us-uat.gladly.qa/api/v1/customer-profiles?email=abc',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic dGVzdFVzZXJOYW1lOnRlc3RBcGlUb2tlbg==',
},
},
httpRes: {
data: {
errors: [
{
attr: 'email',
code: 'invalid',
detail: 'invalid email address',
},
],
},
status: 400,
},
},
];

export const networkCallsData = [...deleteNwData];
Loading

0 comments on commit 7186398

Please sign in to comment.