-
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.
fix: hubspot: search for contact using secondary prop (#3258)
* fix: hubspot: search for contact using secondary prop * chore: include network.ts file * chore: address comments
- Loading branch information
1 parent
1bfcd27
commit 0b57204
Showing
6 changed files
with
288 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ const { | |
validatePayloadDataTypes, | ||
getObjectAndIdentifierType, | ||
} = require('./util'); | ||
const { primaryToSecondaryFields } = require('./config'); | ||
|
||
const propertyMap = { | ||
firstName: 'string', | ||
|
@@ -205,7 +206,7 @@ describe('extractUniqueValues utility test cases', () => { | |
describe('getRequestDataAndRequestOptions utility test cases', () => { | ||
it('Should return an object with requestData and requestOptions', () => { | ||
const identifierType = 'email'; | ||
const chunk = '[email protected]'; | ||
const chunk = ['[email protected]']; | ||
const accessToken = 'dummyAccessToken'; | ||
|
||
const expectedRequestData = { | ||
|
@@ -219,8 +220,17 @@ describe('getRequestDataAndRequestOptions utility test cases', () => { | |
}, | ||
], | ||
}, | ||
{ | ||
filters: [ | ||
{ | ||
propertyName: primaryToSecondaryFields[identifierType], | ||
values: chunk, | ||
operator: 'IN', | ||
}, | ||
], | ||
}, | ||
], | ||
properties: [identifierType], | ||
properties: [identifierType, primaryToSecondaryFields[identifierType]], | ||
limit: 100, | ||
after: 0, | ||
}; | ||
|
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 |
---|---|---|
|
@@ -460,6 +460,37 @@ export const networkCallsData = [ | |
status: 200, | ||
}, | ||
}, | ||
{ | ||
httpReq: { | ||
url: 'https://api.hubapi.com/crm/v3/objects/contacts/search', | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: 'Bearer dummy-access-token-hs-additonal-email', | ||
}, | ||
}, | ||
httpRes: { | ||
data: { | ||
total: 1, | ||
results: [ | ||
{ | ||
id: '103689', | ||
properties: { | ||
createdate: '2022-07-15T15:25:08.975Z', | ||
email: '[email protected]', | ||
hs_object_id: '103604', | ||
hs_additional_emails: '[email protected];[email protected]', | ||
lastmodifieddate: '2022-07-15T15:26:49.590Z', | ||
}, | ||
createdAt: '2022-07-15T15:25:08.975Z', | ||
updatedAt: '2022-07-15T15:26:49.590Z', | ||
archived: false, | ||
}, | ||
], | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
{ | ||
httpReq: { | ||
url: 'https://api.hubapi.com/crm/v3/objects/contacts/search', | ||
|
Oops, something went wrong.