-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test cases to increase coverage
- Loading branch information
Showing
2 changed files
with
343 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,4 +163,148 @@ export const networkCallsData = [ | |
status: 200, | ||
}, | ||
}, | ||
{ | ||
httpReq: { | ||
url: 'https://demo-domain.gainsightcloud.com/v1/data/objects/query/Company', | ||
headers: { | ||
Accesskey: 'valid-access-key-for-update-group', | ||
'Content-Type': 'application/json', | ||
}, | ||
method: 'POST', | ||
}, | ||
httpRes: { | ||
data: { | ||
result: true, | ||
errorCode: null, | ||
errorDesc: null, | ||
requestId: '8863e73c-a465-4fc6-a385-f7b3200720dc', | ||
data: { | ||
records: [ | ||
{ | ||
Name: 'Heroku', | ||
Renewal_Date: 1521743018667, | ||
Status: '1P01OI3OHC9S79J7VN8GQLUQDH0Y52CYFMXW', | ||
Stage: '1I0054U9FAKXZ0H26HO92M3F1G5SPWVQDNF3', | ||
Customer_Lifetime_in_Months: 22, | ||
'csm__gr.email': '[email protected]', | ||
}, | ||
{ | ||
Name: 'ABC Inc.', | ||
Renewal_Date: 1521743018667, | ||
Status: '1P01OI3OHC9S79J7VN8GQLUQDH0Y52CYFMXW', | ||
Stage: '1I0054U9FAKXZ0H26HO92M3F1G5SPWVQDNF3', | ||
Customer_Lifetime_in_Months: 15, | ||
'csm__gr.email': '[email protected]', | ||
}, | ||
{ | ||
Name: 'XYZ Inc.', | ||
Renewal_Date: 1521743018667, | ||
Status: '1P01OI3OHC9S79J7VN8GQLUQDH0Y52CYFMXW', | ||
Stage: '1I0054U9FAKXZ0H26HO92M3F1G5SPWVQDNF3', | ||
Customer_Lifetime_in_Months: 6, | ||
'csm__gr.email': '[email protected]', | ||
}, | ||
], | ||
}, | ||
message: null, | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
{ | ||
httpReq: { | ||
url: 'https://demo-domain.gainsightcloud.com/v1/data/objects/Company', | ||
headers: { | ||
Accesskey: 'valid-access-key-for-update-group', | ||
'Content-Type': 'application/json', | ||
}, | ||
data: { | ||
records: [ | ||
{ | ||
Name: 'Testing company', | ||
Employees: 100, | ||
CompanyType: 'spoof', | ||
Industry: 'Sitcom', | ||
Status: 'complete', | ||
}, | ||
], | ||
}, | ||
method: 'PUT', | ||
}, | ||
httpRes: { | ||
data: { | ||
result: true, | ||
errorCode: null, | ||
errorDesc: null, | ||
requestId: 'eaa1520f-0b27-4468-86b0-17b4e94f1786', | ||
data: { | ||
count: 2, | ||
errors: null, | ||
records: [ | ||
{ | ||
CompanyType: 'spoof', | ||
Employees: 100, | ||
Industry: 'Sitcom', | ||
Name: 'Testing company', | ||
Status: 'complete', | ||
Gsid: '12345', | ||
}, | ||
], | ||
}, | ||
message: null, | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
{ | ||
httpReq: { | ||
url: 'https://demo-domain.gainsightcloud.com/v1/data/objects/Company', | ||
headers: { | ||
Accesskey: 'valid-access-key-for-update-group', | ||
'Content-Type': 'application/json', | ||
}, | ||
data: { | ||
records: [ | ||
{ | ||
Name: 'Testing company with failed update', | ||
Employees: 100, | ||
CompanyType: 'spoof', | ||
Industry: 'Sitcom', | ||
Status: 'complete', | ||
}, | ||
], | ||
}, | ||
method: 'PUT', | ||
}, | ||
httpRes: { | ||
data: { | ||
result: false, | ||
errorCode: 'GSOBJ_1006', | ||
errorDesc: 'Invalid dateTimes format (OriginalContractDate = 210318).', | ||
requestId: '7cba3c98-b04b-4e21-9e57-44807fa52b8a', | ||
data: { | ||
count: 0, | ||
errors: [ | ||
[ | ||
{ | ||
success: false, | ||
parsedValue: 210318, | ||
errors: [ | ||
{ | ||
errorMessage: 'Invalid dateTime format', | ||
errorCode: 'GSOBJ_1006', | ||
fieldName: 'OriginalContractDate', | ||
invalidValue: 210318, | ||
}, | ||
], | ||
}, | ||
], | ||
], | ||
records: null, | ||
}, | ||
message: null, | ||
}, | ||
status: 400, | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1156,4 +1156,203 @@ export const data = [ | |
}, | ||
}, | ||
}, | ||
{ | ||
name: 'gainsight', | ||
description: 'group call when we need to update the existing group', | ||
feature: 'processor', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: [ | ||
{ | ||
destination: { | ||
Config: { | ||
domain: 'demo-domain.gainsightcloud.com', | ||
accessKey: 'valid-access-key-for-update-group', | ||
sharedSecret: 'sample-shared-secret', | ||
personMap: [], | ||
companyMap: [], | ||
eventNameMap: [], | ||
eventVersionMap: [], | ||
}, | ||
}, | ||
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, | ||
}, | ||
traits: { | ||
email: '[email protected]', | ||
}, | ||
}, | ||
messageId: '84e26acc-56a5-4835-8233-591137fca468', | ||
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', | ||
originalTimestamp: '2019-10-14T09:03:17.562Z', | ||
anonymousId: 'anon_id', | ||
type: 'group', | ||
traits: { | ||
name: 'Testing company', | ||
industry: 'Sitcom', | ||
employees: '100', | ||
status: 'complete', | ||
companyType: 'spoof', | ||
}, | ||
integrations: { | ||
All: true, | ||
}, | ||
sentAt: '2019-10-14T09:03:22.563Z', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: [ | ||
{ | ||
output: { | ||
body: { | ||
FORM: {}, | ||
JSON: { | ||
Email: '[email protected]', | ||
companies: [ | ||
{ | ||
Company_ID: '12345', | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
}, | ||
endpoint: 'https://demo-domain.gainsightcloud.com/v1.0/api/people', | ||
files: {}, | ||
headers: { | ||
Accesskey: 'valid-access-key-for-update-group', | ||
'Content-Type': 'application/json', | ||
}, | ||
method: 'PUT', | ||
params: {}, | ||
type: 'REST', | ||
userId: '', | ||
version: '1', | ||
}, | ||
statusCode: 200, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'gainsight', | ||
description: 'group call when we need to update the existing group but the update call failed', | ||
feature: 'processor', | ||
id: 'gainsightUpdateGroup', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: [ | ||
{ | ||
destination: { | ||
Config: { | ||
domain: 'demo-domain.gainsightcloud.com', | ||
accessKey: 'valid-access-key-for-update-group', | ||
sharedSecret: 'sample-shared-secret', | ||
personMap: [], | ||
companyMap: [], | ||
eventNameMap: [], | ||
eventVersionMap: [], | ||
}, | ||
}, | ||
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, | ||
}, | ||
traits: { | ||
email: '[email protected]', | ||
}, | ||
}, | ||
messageId: '84e26acc-56a5-4835-8233-591137fca468', | ||
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22', | ||
originalTimestamp: '2019-10-14T09:03:17.562Z', | ||
anonymousId: 'anon_id', | ||
type: 'group', | ||
traits: { | ||
name: 'Testing company with failed update', | ||
industry: 'Sitcom', | ||
employees: '100', | ||
status: 'complete', | ||
companyType: 'spoof', | ||
}, | ||
integrations: { | ||
All: true, | ||
}, | ||
sentAt: '2019-10-14T09:03:22.563Z', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: [ | ||
{ | ||
error: | ||
'{"message":"failed to update group {\\"result\\":false,\\"errorCode\\":\\"GSOBJ_1006\\",\\"errorDesc\\":\\"Invalid dateTimes format (OriginalContractDate = 210318).\\",\\"requestId\\":\\"7cba3c98-b04b-4e21-9e57-44807fa52b8a\\",\\"data\\":{\\"count\\":0,\\"errors\\":[[{\\"success\\":false,\\"parsedValue\\":210318,\\"errors\\":[{\\"errorMessage\\":\\"Invalid dateTime format\\",\\"errorCode\\":\\"GSOBJ_1006\\",\\"fieldName\\":\\"OriginalContractDate\\",\\"invalidValue\\":210318}]}]],\\"records\\":null},\\"message\\":null}","destinationResponse":{"response":{"result":false,"errorCode":"GSOBJ_1006","errorDesc":"Invalid dateTimes format (OriginalContractDate = 210318).","requestId":"7cba3c98-b04b-4e21-9e57-44807fa52b8a","data":{"count":0,"errors":[[{"success":false,"parsedValue":210318,"errors":[{"errorMessage":"Invalid dateTime format","errorCode":"GSOBJ_1006","fieldName":"OriginalContractDate","invalidValue":210318}]}]],"records":null},"message":null},"status":400}}', | ||
statTags: { | ||
destType: 'GAINSIGHT', | ||
errorCategory: 'network', | ||
errorType: 'aborted', | ||
feature: 'processor', | ||
implementation: 'native', | ||
module: 'destination', | ||
}, | ||
statusCode: 400, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
]; |