sr-npm 1.7.438 → 1.7.440
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.
|
@@ -76,6 +76,12 @@ const COLLECTIONS_FIELDS = {
|
|
|
76
76
|
EXTERNAL: 'PUBLIC',
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
const TOKEN_NAME = {
|
|
80
|
+
COMPANY_ID: 'companyId',
|
|
81
|
+
SMART_TOKEN: 'x-smarttoken',
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
79
85
|
module.exports = {
|
|
80
86
|
COLLECTIONS,
|
|
81
87
|
COLLECTIONS_FIELDS,
|
|
@@ -83,4 +89,5 @@ const COLLECTIONS_FIELDS = {
|
|
|
83
89
|
AMOUNT_OF_JOBS_PER_DEPARTMENT_COLLECTION_FIELDS,
|
|
84
90
|
CITIES_COLLECTION_FIELDS,
|
|
85
91
|
TEMPLATE_TYPE,
|
|
92
|
+
TOKEN_NAME,
|
|
86
93
|
};
|
package/backend/consts.js
CHANGED
|
@@ -74,10 +74,6 @@ const TASKS = {
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
const TOKEN_NAME = {
|
|
78
|
-
COMPANY_ID: 'companyId',
|
|
79
|
-
SMART_TOKEN: 'x-smarttoken',
|
|
80
|
-
}
|
|
81
77
|
|
|
82
78
|
const TASK_TYPE = {
|
|
83
79
|
SCHEDULED: 'scheduled',
|
|
@@ -89,5 +85,4 @@ const TASK_TYPE = {
|
|
|
89
85
|
TASK_TYPE,
|
|
90
86
|
TASKS,
|
|
91
87
|
QUERY_MAX_LIMIT,
|
|
92
|
-
TOKEN_NAME,
|
|
93
88
|
};
|
package/backend/data.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
const { items: wixData } = require('@wix/data');
|
|
2
2
|
const { fetchPositionsFromSRAPI, fetchJobDescription } = require('./fetchPositionsFromSRAPI');
|
|
3
3
|
const { createCollectionIfMissing } = require('@hisense-staging/velo-npm/backend');
|
|
4
|
-
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE } = require('./collectionConsts');
|
|
4
|
+
const { COLLECTIONS, COLLECTIONS_FIELDS,JOBS_COLLECTION_FIELDS,TEMPLATE_TYPE,TOKEN_NAME } = require('./collectionConsts');
|
|
5
5
|
const { chunkedBulkOperation, countJobsPerGivenField, fillCityLocationAndLocationAddress ,prepareToSaveArray,normalizeCityName} = require('./utils');
|
|
6
6
|
const { getAllPositions } = require('./queries');
|
|
7
|
-
const{TOKEN_NAME} = require('./consts');
|
|
8
7
|
const { getCompanyId, getSmartToken } = require('./secretsData');
|
|
9
8
|
|
|
10
9
|
function validatePosition(position) {
|
|
@@ -363,7 +362,6 @@ async function fillSecretManagerMirror() {
|
|
|
363
362
|
console.log("Getting the company ID ");
|
|
364
363
|
const companyId = await getCompanyId();
|
|
365
364
|
console.log("companyId is : ", companyId);
|
|
366
|
-
console.log("TOKEN_NAME is , ", TOKEN_NAME);
|
|
367
365
|
await wixData.insert(COLLECTIONS.SECRET_MANAGER_MIRROR, {
|
|
368
366
|
tokenName: TOKEN_NAME.COMPANY_ID,
|
|
369
367
|
tokenValue: companyId.value
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const { fetch } = require('wix-fetch');
|
|
2
2
|
const { items: wixData } = require('@wix/data');
|
|
3
|
-
const { COLLECTIONS,TEMPLATE_TYPE } = require('./collectionConsts');
|
|
4
|
-
const { TOKEN_NAME } = require('./consts');
|
|
3
|
+
const { COLLECTIONS,TEMPLATE_TYPE,TOKEN_NAME } = require('./collectionConsts');
|
|
5
4
|
async function makeSmartRecruitersRequest(path,templateType) {
|
|
6
5
|
const baseUrl = 'https://api.smartrecruiters.com';
|
|
7
6
|
const fullUrl = `${baseUrl}${path}`;
|
package/package.json
CHANGED
|
@@ -1,35 +1,49 @@
|
|
|
1
1
|
const { executeApiRequest } = require('tests-utils');
|
|
2
2
|
const { getRandomPosition, executeRequestAndTest } = require('./testsUtils');
|
|
3
3
|
|
|
4
|
-
describe('Job details fetch from SR API Tests', () => {
|
|
4
|
+
describe('Job details fetch from SR API Tests', async () => {
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const templateTypes = [
|
|
7
|
+
{ templateType: 'External'},
|
|
8
|
+
{ templateType: 'Internal'}
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
templateTypes.forEach(({ templateType }) => {
|
|
12
|
+
describe(`Job details fetch from SR API Tests - ${templateType}`, async () => {
|
|
13
|
+
const markTemplateAsRequestBody = `markTemplateAs${templateType}();`;
|
|
14
|
+
try{
|
|
15
|
+
await executeApiRequest(markTemplateAsRequestBody);
|
|
16
|
+
}
|
|
17
|
+
catch(error){
|
|
18
|
+
console.error(`Error marking template as ${templateType}:`, error);
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
const fetchPositionsFromSRAPIRequestBody = `fetchPositionsFromSRAPI();`;
|
|
22
|
+
const positions = await executeApiRequest(fetchPositionsFromSRAPIRequestBody);
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
test(`should successfully fetch job details from SR API (${templateType})`, async () => {
|
|
25
|
+
const randomPosition = getRandomPosition(positions.data.result.content);
|
|
26
|
+
expect(positions.data.result.totalFound).toBeGreaterThan(0);
|
|
27
|
+
expect(positions.data.result.content.length).toBeGreaterThan(0);
|
|
28
|
+
expect(randomPosition.id.length).toBeGreaterThan(0);
|
|
29
|
+
expect(randomPosition.name.length).toBeGreaterThan(0);
|
|
30
|
+
expect(randomPosition.jobAdId.length).toBeGreaterThan(0);
|
|
31
|
+
expect(randomPosition.location).toBeDefined();
|
|
32
|
+
expect(randomPosition.department).toBeDefined();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test(`should successfully fetch job description from SR API (${templateType})`, async () => {
|
|
36
|
+
const randomPosition = getRandomPosition(positions.data.result.content);
|
|
37
|
+
const fetchJobDescriptionRequestBody = `fetchJobDescription(${randomPosition.id});`;
|
|
38
|
+
const jobFetchResponse = await executeApiRequest(fetchJobDescriptionRequestBody);
|
|
39
|
+
expect(jobFetchResponse.data.result.id).toBe(randomPosition.id);
|
|
40
|
+
expect(jobFetchResponse.data.result.jobAd.sections.jobDescription).toBeDefined();
|
|
41
|
+
expect(jobFetchResponse.data.result.jobAd.sections.jobDescription.text.length).toBeGreaterThan(0);
|
|
42
|
+
expect(jobFetchResponse.data.result.applyUrl.length).toBeGreaterThan(0);
|
|
43
|
+
expect(jobFetchResponse.data.result.location).toBeDefined();
|
|
44
|
+
});
|
|
32
45
|
});
|
|
46
|
+
});
|
|
33
47
|
});
|
|
34
48
|
|
|
35
49
|
describe('fetchPositionsFromSRAPI error handling', () => {
|