sr-npm 1.7.444 → 1.7.446

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -103,8 +103,13 @@ async function fetchPositionsFromSRAPI(testObject=undefined) {
103
103
  return result;
104
104
  }
105
105
 
106
- async function fetchJobDescription(jobId) {
107
- const {companyId,templateType} = await getApiKeys();
106
+ async function fetchJobDescription(jobId,testObject=undefined) {
107
+ let companyId, templateType;
108
+ if (testObject) {
109
+ ({ companyId, templateType } = testObject);
110
+ } else {
111
+ ({ companyId, templateType } = await getApiKeys());
112
+ }
108
113
  return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,templateType);
109
114
  }
110
115
 
@@ -11,10 +11,14 @@ function getSmartToken() {
11
11
  }
12
12
 
13
13
  function getCompanyId() {
14
+ console.log("Getting the company ID from the secrets");
14
15
  return getSecretValue("companyID")
15
16
  .then((secret) => {
16
17
  return secret;
17
- })
18
+ }).catch((error) => {
19
+ console.error("Error getting the company ID from the secrets: ", error);
20
+ throw error;
21
+ });
18
22
  }
19
23
  module.exports = {
20
24
  getCompanyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.444",
3
+ "version": "1.7.446",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@ describe('Job details fetch from SR API Tests', () => {
30
30
 
31
31
  test(`should successfully fetch job description from SR API (${templatename})`, async () => {
32
32
  const randomPosition = getRandomPosition(positions.data.result.content);
33
- const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id});`;
33
+ const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id},{companyId:'WixTest',templateType: '${templateType}'});`;
34
34
  const jobFetchResponse = await executeApiRequest(fetchJobDescriptionRequestBody);
35
35
  expect(jobFetchResponse.data.result.id).toBe(randomPosition.id);
36
36
  expect(jobFetchResponse.data.result.jobAd.sections.jobDescription).toBeDefined();