Skip to content

Commit

Permalink
fix: added unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
manish339k committed Nov 12, 2024
1 parent 4d6fa4e commit b13f28c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v0/destinations/gainsight_px/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@ module.exports = {
getUsersEndpoint,
getCustomEventsEndpoint,
getAccountsEndpoint,
BASE_ENDPOINT,
BASE_EU_ENDPOINT,
BASE_US2_ENDPOINT,
getBaseEndpoint,
};
27 changes: 27 additions & 0 deletions src/v0/destinations/gainsight_px/config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { BASE_ENDPOINT, BASE_EU_ENDPOINT, BASE_US2_ENDPOINT, getBaseEndpoint } = require('./config');

describe('getBaseEndpoint method test', () => {
it('Should return BASE_ENDPOINT when destination.Config.dataCenter is not "EU" or "US2"', () => {
const Config = {
dataCenter: 'US',
};
const result = getBaseEndpoint(Config);
expect(result).toBe(BASE_ENDPOINT);
});

it('Should return BASE_EU_ENDPOINT when destination.Config.dataCenter is "EU"', () => {
const Config = {
dataCenter: 'EU',
};
const result = getBaseEndpoint(Config);
expect(result).toBe(BASE_EU_ENDPOINT);
});

it('Should return BASE_US2_ENDPOINT when destination.Config.dataCenter is "US2"', () => {
const Config = {
dataCenter: 'US2',
};
const result = getBaseEndpoint(Config);
expect(result).toBe(BASE_US2_ENDPOINT);
});
});

0 comments on commit b13f28c

Please sign in to comment.