Skip to content

Commit

Permalink
chore: add component test cases for some destinations part1 (#2915)
Browse files Browse the repository at this point in the history
* chore: add component test cases for some destinations

* chore: add method to network.ts
  • Loading branch information
ItsSudip authored Dec 20, 2023
1 parent 3676039 commit d0e24d3
Show file tree
Hide file tree
Showing 55 changed files with 12,722 additions and 10,411 deletions.
56 changes: 2 additions & 54 deletions test/__mocks__/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,15 @@ const mailchimpGetRequestHandler = require("./mailchimp.mock");
const yahooDspPostRequestHandler = require("./yahoo_dsp.mock");
const { gainsightPXGetRequestHandler } = require("./gainsight_px.mock");
const { hsGetRequestHandler, hsPostRequestHandler } = require("./hs.mock");
const { delightedGetRequestHandler } = require("./delighted.mock");
const { dripPostRequestHandler } = require("./drip.mock");
const profitwellGetRequestHandler = require("./profitwell.mock");
const cannyPostRequestHandler = require("./canny.mock");
const custifyPostRequestHandler = require("./custify.mock");
const {
wootricGetRequestHandler,
wootricPostRequestHandler
} = require("./wootric.mock");
const { userGetRequestHandler, userPutRequestHandler } = require("./user.mock");
const { mixpanelPostRequestHandler } = require("./mixpanel.mock");
const { clickUpGetRequestHandler } = require("./clickup.mock");
const {
freshmarketerPostRequestHandler,
freshmarketerGetRequestHandler
} = require("./freshmarketer.mock");
const { mondayPostRequestHandler } = require("./monday.mock");
const {
freshsalesGetRequestHandler,
freshsalesPostRequestHandler
} = require("./freshsales.mock");
const { sendgridGetRequestHandler } = require("./sendgrid.mock");
const { sendinblueGetRequestHandler } = require("./sendinblue.mock");
const { courierGetRequestHandler } = require("./courier.mock");
Expand Down Expand Up @@ -109,26 +97,9 @@ function get(url, options) {
if (url.includes("https://api.hubapi.com")) {
return hsGetRequestHandler(url, mockData);
}
if (url.includes("https://api.delighted.com/v1/people.json")) {
return delightedGetRequestHandler(options);
}
if (url.includes("https://api.profitwell.com")) {
return profitwellGetRequestHandler(url, mockData);
}
if (
url.includes(
"https://api.getdrip.com/v2/1809802/subscribers/[email protected]"
)
) {
return Promise.resolve({ status: 200 });
}
if (
url.includes(
"https://api.getdrip.com/v2/1809802/subscribers/[email protected]"
)
) {
return Promise.reject({ status: 404 });
}
if (url.includes("https://api.wootric.com")) {
return new Promise((resolve, reject) => {
resolve(wootricGetRequestHandler(url));
Expand All @@ -139,15 +110,6 @@ function get(url, options) {
resolve(userGetRequestHandler(url));
});
}
if (url.includes("https://api.clickup.com")) {
return Promise.resolve(clickUpGetRequestHandler(url));
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return Promise.resolve(freshmarketerGetRequestHandler(url));
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return Promise.resolve(freshsalesGetRequestHandler(url));
}
if (url.includes("https://api.sendgrid.com/v3/marketing/field_definitions")) {
return Promise.resolve(sendgridGetRequestHandler(url));
}
Expand Down Expand Up @@ -197,9 +159,6 @@ function post(url, payload) {
resolve(yahooDspPostRequestHandler(url, payload));
});
}
if (url.includes("https://api.getdrip.com/v2/1809802/subscribers")) {
return dripPostRequestHandler(url, payload);
}
if (url.includes("https://canny.io/api/v1/users/retrieve")) {
return new Promise((resolve, reject) => {
resolve(cannyPostRequestHandler(url));
Expand All @@ -221,16 +180,7 @@ function post(url, payload) {
resolve(mixpanelPostRequestHandler(url, payload));
});
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return new Promise((resolve, reject) => {
resolve(freshmarketerPostRequestHandler(url));
});
}
if (url.includes("https://domain-rudder.myfreshworks.com/crm/sales/api")) {
return new Promise((resolve, reject) => {
resolve(freshsalesPostRequestHandler(url));
});
}

if (
url.includes("https://api.monday.com") &&
payload.query.includes("query")
Expand All @@ -239,9 +189,7 @@ function post(url, payload) {
resolve(mondayPostRequestHandler(payload));
});
}
if (url.includes("https://api.custify.com")) {
return Promise.resolve(custifyPostRequestHandler(url));
}

return new Promise((resolve, reject) => {
if (mockData) {
resolve({ data: mockData, status: 200 });
Expand Down
36 changes: 0 additions & 36 deletions test/__mocks__/clickup.mock.js

This file was deleted.

36 changes: 0 additions & 36 deletions test/__mocks__/custify.mock.js

This file was deleted.

Loading

0 comments on commit d0e24d3

Please sign in to comment.