sr-npm 1.7.454 → 1.7.455
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.
package/backend/data.js
CHANGED
|
@@ -318,6 +318,9 @@ async function referenceJobs() {
|
|
|
318
318
|
|
|
319
319
|
async function syncJobsFast() {
|
|
320
320
|
console.log("Syncing jobs fast");
|
|
321
|
+
//database
|
|
322
|
+
|
|
323
|
+
|
|
321
324
|
await createCollections();
|
|
322
325
|
await clearCollections();
|
|
323
326
|
await fillSecretManagerMirror();
|
|
@@ -344,6 +347,7 @@ async function clearCollections() {
|
|
|
344
347
|
}
|
|
345
348
|
|
|
346
349
|
async function markTemplateAsExternal() {
|
|
350
|
+
console.log("TEMPLATE_TYPE$#@#$$@#@#$",TEMPLATE_TYPE);
|
|
347
351
|
await createCollectionIfMissing(COLLECTIONS.TEMPLATE_TYPE, COLLECTIONS_FIELDS.TEMPLATE_TYPE,null,'singleItem');
|
|
348
352
|
await wixData.save(COLLECTIONS.TEMPLATE_TYPE, {
|
|
349
353
|
templateType: TEMPLATE_TYPE.EXTERNAL
|
|
@@ -8,11 +8,13 @@ async function makeSmartRecruitersRequest(path,templateType) {
|
|
|
8
8
|
const fullUrl = `${baseUrl}${path}`;
|
|
9
9
|
|
|
10
10
|
try {
|
|
11
|
+
//if templatetype is internal make headers object with x-smarttoken
|
|
11
12
|
const headers = {
|
|
12
13
|
'Accept-Language': 'en',
|
|
13
14
|
'accept': 'application/json',
|
|
14
15
|
'Cookie': 'AWSALB=GYltFw3fLKortMxHR5vIOT1CuUROyhWNIX/qL8ZnPl1/8mhOcnIsBKYslzmNJPEzSy/jvNbO+6tXpH8yqcpQJagYt57MhbKlLqTSzoNq1G/w7TjOxPGR3UTdXW0d; AWSALBCORS=GYltFw3fLKortMxHR5vIOT1CuUROyhWNIX/qL8ZnPl1/8mhOcnIsBKYslzmNJPEzSy/jvNbO+6tXpH8yqcpQJagYt57MhbKlLqTSzoNq1G/w7TjOxPGR3UTdXW0d'
|
|
15
16
|
};
|
|
17
|
+
//here is the only place where we check templateType
|
|
16
18
|
if (templateType === TEMPLATE_TYPE.INTERNAL) {
|
|
17
19
|
const smartToken = await getTokenFromCMS(TOKEN_NAME.SMART_TOKEN);
|
|
18
20
|
headers['x-smarttoken'] = smartToken;
|
|
@@ -34,7 +36,7 @@ async function makeSmartRecruitersRequest(path,templateType) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
async function fetchPositionsFromSRAPI(
|
|
39
|
+
async function fetchPositionsFromSRAPI() {
|
|
38
40
|
let allPositions = [];
|
|
39
41
|
let totalFound = 0;
|
|
40
42
|
let page = 0;
|
package/backend/secretsData.js
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { executeApiRequest } = require('tests-utils');
|
|
2
|
-
const { getRandomPosition
|
|
2
|
+
const { getRandomPosition } = require('./testsUtils');
|
|
3
3
|
|
|
4
4
|
describe('Job details fetch from SR API Tests', () => {
|
|
5
5
|
|
|
@@ -30,30 +30,6 @@ describe('Job details fetch from SR API Tests', () => {
|
|
|
30
30
|
expect(jobFetchResponse.data.result.applyUrl.length).toBeGreaterThan(0);
|
|
31
31
|
expect(jobFetchResponse.data.result.location).toBeDefined();
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
test('should throw error if invalid companyId is found', async () => {
|
|
37
|
-
const requestBody = `fetchPositionsFromSRAPI('invalid_company_id');`;
|
|
38
|
-
executeRequestAndTest(requestBody)
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('should throw error when a bad URL is used', async () => {
|
|
42
|
-
const requestBody = `makeSmartRecruitersRequest('/v1/error/companyId/postings');`;
|
|
43
|
-
executeRequestAndTest(requestBody)
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('fetchJobDescription error handling', () => {
|
|
51
|
-
test('should throw error if invalid jobId is given', async () => {
|
|
52
|
-
const requestBody = `fetchJobDescription('invalid_job_id');`;
|
|
53
|
-
executeRequestAndTest(requestBody)
|
|
54
|
-
});
|
|
55
|
-
test('should throw error when given a valid but wrong jobId is given', async () => {
|
|
56
|
-
const requestBody = `fetchJobDescription('1234567890');`;
|
|
57
|
-
executeRequestAndTest(requestBody)
|
|
58
|
-
});
|
|
59
|
-
});
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
});
|
package/tests/testsUtils.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
const { executeApiRequest } = require('tests-utils');
|
|
2
|
-
|
|
3
1
|
function getRandomPosition(positions) {
|
|
4
2
|
return positions[Math.floor(Math.random() * positions.length)];
|
|
5
3
|
}
|
|
6
|
-
async function executeRequestAndTest(requestBody) {
|
|
7
|
-
try{
|
|
8
|
-
response = await executeApiRequest(requestBody);
|
|
9
|
-
expect(response.status).not.toBe(500);
|
|
10
|
-
}catch(error){
|
|
11
|
-
expect(error.message).toBe('Request failed with status code 500');
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
4
|
|
|
15
5
|
module.exports = {
|
|
16
|
-
getRandomPosition
|
|
6
|
+
getRandomPosition
|
|
17
7
|
}
|