sr-npm 1.7.446 → 1.7.448

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.
@@ -33,6 +33,7 @@ async function makeSmartRecruitersRequest(path,templateType) {
33
33
  }
34
34
 
35
35
  async function fetchPositionsFromSRAPI(testObject=undefined) {
36
+
36
37
  let allPositions = [];
37
38
  let totalFound = 0;
38
39
  let page = 0;
@@ -103,13 +104,8 @@ async function fetchPositionsFromSRAPI(testObject=undefined) {
103
104
  return result;
104
105
  }
105
106
 
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
- }
107
+ async function fetchJobDescription(jobId) {
108
+ const {companyId,templateType} = await getApiKeys();
113
109
  return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`,templateType);
114
110
  }
115
111
 
@@ -11,14 +11,10 @@ function getSmartToken() {
11
11
  }
12
12
 
13
13
  function getCompanyId() {
14
- console.log("Getting the company ID from the secrets");
15
14
  return getSecretValue("companyID")
16
15
  .then((secret) => {
17
16
  return secret;
18
- }).catch((error) => {
19
- console.error("Error getting the company ID from the secrets: ", error);
20
- throw error;
21
- });
17
+ })
22
18
  }
23
19
  module.exports = {
24
20
  getCompanyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.446",
3
+ "version": "1.7.448",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,43 +3,33 @@ const { getRandomPosition, executeRequestAndTest } = require('./testsUtils');
3
3
 
4
4
  describe('Job details fetch from SR API Tests', () => {
5
5
 
6
- const templateTypes = [
7
- { templatename: 'External', templateType: 'PUBLIC'},
8
- { templatename: 'Internal', templateType: 'INTERNAL'}
9
- ];
10
-
11
- templateTypes.forEach(({ templateType ,templatename}) => {
12
- describe(`Job details fetch from SR API Tests - ${templatename}`, () => {
13
- let positions;
14
- beforeAll(async () => {
15
- const fetchPositionsFromSRAPIRequestBody = `fetchPositionsFromSRAPI({companyId:'WixTest',templateType: '${templateType}'});`;
16
- positions = await executeApiRequest(fetchPositionsFromSRAPIRequestBody);
17
- });
18
-
19
-
20
- test(`should successfully fetch job details from SR API (${templatename})`, async () => {
21
- const randomPosition = getRandomPosition(positions.data.result.content);
22
- expect(positions.data.result.totalFound).toBeGreaterThan(0);
23
- expect(positions.data.result.content.length).toBeGreaterThan(0);
24
- expect(randomPosition.id.length).toBeGreaterThan(0);
25
- expect(randomPosition.name.length).toBeGreaterThan(0);
26
- expect(randomPosition.jobAdId.length).toBeGreaterThan(0);
27
- expect(randomPosition.location).toBeDefined();
28
- expect(randomPosition.department).toBeDefined();
29
- });
6
+ let positions;
7
+ beforeAll(async () => {
8
+ const requestBody = `fetchPositionsFromSRAPI();`;
9
+ positions = await executeApiRequest(requestBody);
10
+ });
11
+
12
+ test('should successfully fetch job details from SR API', async () => {
13
+ const randomPosition = getRandomPosition(positions.data.result.content);
14
+ expect(positions.data.result.totalFound).toBeGreaterThan(0);
15
+ expect(positions.data.result.content.length).toBeGreaterThan(0);
16
+ expect(randomPosition.id.length).toBeGreaterThan(0);
17
+ expect(randomPosition.name.length).toBeGreaterThan(0);
18
+ expect(randomPosition.jobAdId.length).toBeGreaterThan(0);
19
+ expect(randomPosition.location).toBeDefined();
20
+ expect(randomPosition.department).toBeDefined();
21
+ });
30
22
 
31
- test(`should successfully fetch job description from SR API (${templatename})`, async () => {
32
- const randomPosition = getRandomPosition(positions.data.result.content);
33
- const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id},{companyId:'WixTest',templateType: '${templateType}'});`;
34
- const jobFetchResponse = await executeApiRequest(fetchJobDescriptionRequestBody);
35
- expect(jobFetchResponse.data.result.id).toBe(randomPosition.id);
36
- expect(jobFetchResponse.data.result.jobAd.sections.jobDescription).toBeDefined();
37
- expect(jobFetchResponse.data.result.jobAd.sections.jobDescription.text.length).toBeGreaterThan(0);
38
- expect(jobFetchResponse.data.result.applyUrl.length).toBeGreaterThan(0);
39
- expect(jobFetchResponse.data.result.location).toBeDefined();
40
- });
23
+ test('should successfully fetch job description from SR API', async () => {
24
+ const randomPosition = getRandomPosition(positions.data.result.content);
25
+ const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id});`;
26
+ const jobFetchResponse = await executeApiRequest(fetchJobDescriptionRequestBody);
27
+ expect(jobFetchResponse.data.result.id).toBe(randomPosition.id);
28
+ expect(jobFetchResponse.data.result.jobAd.sections.jobDescription).toBeDefined();
29
+ expect(jobFetchResponse.data.result.jobAd.sections.jobDescription.text.length).toBeGreaterThan(0);
30
+ expect(jobFetchResponse.data.result.applyUrl.length).toBeGreaterThan(0);
31
+ expect(jobFetchResponse.data.result.location).toBeDefined();
41
32
  });
42
- });
43
33
  });
44
34
 
45
35
  describe('fetchPositionsFromSRAPI error handling', () => {