-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integrations): add validation rules to salesforce fetch-fields
- Loading branch information
1 parent
3bdf6fd
commit 4e75075
Showing
10 changed files
with
457 additions
and
51 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { vi, expect, it, describe } from "vitest"; | ||
import type { NangoSync } from "../models.js"; | ||
|
||
import fetchData from "../syncs/accounts.js"; | ||
|
||
describe("salesforce accounts tests", () => { | ||
const nangoMock = new global.vitest.NangoSyncMock({ | ||
dirname: __dirname, | ||
name: "accounts", | ||
Model: "SalesforceAccount" | ||
}); | ||
it("should get, map correctly the data and batchSave the result", async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchSaveData = await nangoMock.getBatchSaveData(); | ||
expect(nangoMock.batchSave).toHaveBeenCalledWith(batchSaveData, "SalesforceAccount"); | ||
}); | ||
|
||
it('should get, map correctly the data and batchDelete the result', async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchDeleteData = await nangoMock.getBatchDeleteData(); | ||
if (batchDeleteData && batchDeleteData.length > 0) { | ||
expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, "SalesforceAccount"); | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { vi, expect, it, describe } from "vitest"; | ||
import type { NangoSync } from "../models.js"; | ||
|
||
import fetchData from "../syncs/articles.js"; | ||
|
||
describe("salesforce articles tests", () => { | ||
const nangoMock = new global.vitest.NangoSyncMock({ | ||
dirname: __dirname, | ||
name: "articles", | ||
Model: "SalesforceArticle" | ||
}); | ||
it("should get, map correctly the data and batchSave the result", async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchSaveData = await nangoMock.getBatchSaveData(); | ||
expect(nangoMock.batchSave).toHaveBeenCalledWith(batchSaveData, "SalesforceArticle"); | ||
}); | ||
|
||
it('should get, map correctly the data and batchDelete the result', async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchDeleteData = await nangoMock.getBatchDeleteData(); | ||
if (batchDeleteData && batchDeleteData.length > 0) { | ||
expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, "SalesforceArticle"); | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { vi, expect, it, describe } from "vitest"; | ||
import type { NangoSync } from "../models.js"; | ||
|
||
import fetchData from "../syncs/contacts.js"; | ||
|
||
describe("salesforce contacts tests", () => { | ||
const nangoMock = new global.vitest.NangoSyncMock({ | ||
dirname: __dirname, | ||
name: "contacts", | ||
Model: "SalesforceContact" | ||
}); | ||
it("should get, map correctly the data and batchSave the result", async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchSaveData = await nangoMock.getBatchSaveData(); | ||
expect(nangoMock.batchSave).toHaveBeenCalledWith(batchSaveData, "SalesforceContact"); | ||
}); | ||
|
||
it('should get, map correctly the data and batchDelete the result', async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchDeleteData = await nangoMock.getBatchDeleteData(); | ||
if (batchDeleteData && batchDeleteData.length > 0) { | ||
expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, "SalesforceContact"); | ||
} | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { vi, expect, it, describe } from "vitest"; | ||
import type { NangoSync } from "../models.js"; | ||
|
||
import fetchData from "../syncs/deals.js"; | ||
|
||
describe("salesforce deals tests", () => { | ||
const nangoMock = new global.vitest.NangoSyncMock({ | ||
dirname: __dirname, | ||
name: "deals", | ||
Model: "SalesforceDeal" | ||
}); | ||
it("should get, map correctly the data and batchSave the result", async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchSaveData = await nangoMock.getBatchSaveData(); | ||
expect(nangoMock.batchSave).toHaveBeenCalledWith(batchSaveData, "SalesforceDeal"); | ||
}); | ||
|
||
it('should get, map correctly the data and batchDelete the result', async () => { | ||
await fetchData(nangoMock); | ||
|
||
const batchDeleteData = await nangoMock.getBatchDeleteData(); | ||
if (batchDeleteData && batchDeleteData.length > 0) { | ||
expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, "SalesforceDeal"); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.