sr-npm 1.7.371 → 1.7.373
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.
|
@@ -34,6 +34,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
34
34
|
let page = 0;
|
|
35
35
|
const MAX_PAGES = 30 // Safety limit to prevent infinite loops
|
|
36
36
|
const companyId = await getCompanyIdFromCMS();
|
|
37
|
+
console.log('companyId@!@#@#@@#!#@@!@#!@#!@#: ', companyId);
|
|
37
38
|
console.log('Starting to fetch all positions with pagination...');
|
|
38
39
|
let offset=0;
|
|
39
40
|
|
|
@@ -42,7 +43,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
42
43
|
page++;
|
|
43
44
|
|
|
44
45
|
// Build the API path - first request has no page parameter, subsequent use nextPageId
|
|
45
|
-
const apiPath = `/v1/companies/${companyId
|
|
46
|
+
const apiPath = `/v1/companies/${companyId}/postings?offset=${offset}`;
|
|
46
47
|
|
|
47
48
|
console.log(`Fetching page ${page} with path: ${apiPath}`);
|
|
48
49
|
const response = await makeSmartRecruitersRequest(apiPath);
|
|
@@ -96,7 +97,7 @@ async function fetchPositionsFromSRAPI() {
|
|
|
96
97
|
|
|
97
98
|
async function fetchJobDescription(jobId) {
|
|
98
99
|
const companyId = await getCompanyIdFromCMS();
|
|
99
|
-
return await makeSmartRecruitersRequest(`/v1/companies/${companyId
|
|
100
|
+
return await makeSmartRecruitersRequest(`/v1/companies/${companyId}/postings/${jobId}`);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
async function getCompanyIdFromCMS() {
|
package/package.json
CHANGED
|
@@ -7,7 +7,6 @@ describe('Job details fetch from SR API Tests', () => {
|
|
|
7
7
|
const requestBody = `fetchPositionsFromSRAPI();`;
|
|
8
8
|
const fetchJobsResponse = await executeApiRequest(requestBody);
|
|
9
9
|
const randomPosition = getRandomPosition(fetchJobsResponse.data.result.content);
|
|
10
|
-
console.log("randomPosition: ", randomPosition);
|
|
11
10
|
expect(fetchJobsResponse.data.result.totalFound).toBeGreaterThan(0);
|
|
12
11
|
expect(fetchJobsResponse.data.result.content.length).toBeGreaterThan(0);
|
|
13
12
|
expect(randomPosition.id.length).toBeGreaterThan(0);
|
|
@@ -23,7 +22,6 @@ describe('Job details fetch from SR API Tests', () => {
|
|
|
23
22
|
const randomPosition = getRandomPosition(positions.data.result.content);
|
|
24
23
|
const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id});`;
|
|
25
24
|
const jobFetchResponse = await executeApiRequest(fetchJobDescriptionRequestBody);
|
|
26
|
-
console.log("jobFetchResponse: ", jobFetchResponse.data.result);
|
|
27
25
|
expect(jobFetchResponse.data.result.id).toBe(randomPosition.id);
|
|
28
26
|
expect(jobFetchResponse.data.result.jobAd.sections.jobDescription).toBeDefined();
|
|
29
27
|
expect(jobFetchResponse.data.result.jobAd.sections.jobDescription.text.length).toBeGreaterThan(0);
|