fix salesforce query (#20196)
This commit is contained in:
@@ -568,7 +568,7 @@ describe("SalesforceCRMService", () => {
|
||||
it("should return all possible account websites from email domain", () => {
|
||||
const result = service.getAllPossibleAccountWebsiteFromEmailDomain("example.com");
|
||||
expect(result).toEqual(
|
||||
"example.com, www.example.com, http://www.example.com, http://example.com, https://www.example.com, https://example.com"
|
||||
"'example.com', 'www.example.com', 'http://www.example.com', 'http://example.com', 'https://www.example.com', 'https://example.com'"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -894,14 +894,15 @@ export default class SalesforceCRMService implements CRM {
|
||||
}
|
||||
|
||||
public getAllPossibleAccountWebsiteFromEmailDomain(emailDomain: string) {
|
||||
return [
|
||||
const websites = [
|
||||
emailDomain,
|
||||
`www.${emailDomain}`,
|
||||
`http://www.${emailDomain}`,
|
||||
`http://${emailDomain}`,
|
||||
`https://www.${emailDomain}`,
|
||||
`https://${emailDomain}`,
|
||||
].join(", ");
|
||||
];
|
||||
return websites.map((website) => `'${website}'`).join(", ");
|
||||
}
|
||||
|
||||
private async getAccountIdBasedOnEmailDomainOfContacts(email: string) {
|
||||
|
||||
@@ -139,7 +139,8 @@ export const createSalesforceMock = () => {
|
||||
if (whereClause.includes("Website IN")) {
|
||||
const websitesMatch = whereClause.match(/Website IN \((.+)\)/i);
|
||||
if (websitesMatch) {
|
||||
const websites = websitesMatch[1].split(",").map((w) => w.trim());
|
||||
// Split by comma, trim spaces and quotes
|
||||
const websites = websitesMatch[1].split(",").map((w) => w.trim().replace(/^'|'$/g, ""));
|
||||
result = result.filter((r) => websites.includes(r.Website));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user