sr-npm 1.7.364 → 1.7.366
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/package.json
CHANGED
|
@@ -1,51 +1,22 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
|
|
1
|
+
const { executeApiRequest } = require('tests-utils');
|
|
2
|
+
const { getRandomPosition } = require('./testsUtils');
|
|
4
3
|
|
|
5
4
|
describe('Job details fetch from SR API Tests', () => {
|
|
6
5
|
|
|
7
|
-
// beforeEach(async () => {
|
|
8
|
-
// await cleanCollection();
|
|
9
|
-
// });
|
|
10
|
-
|
|
11
|
-
describe('fetching job details from SR API', () => {
|
|
12
6
|
test('should successfully fetch job details from SR API', async () => {
|
|
13
|
-
const requestBody = `
|
|
7
|
+
const requestBody = `fetchPositionsFromSRAPI();`;
|
|
14
8
|
const wixDataResponse = await executeApiRequest(requestBody);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// expect(taskData.type).toBe(TASK_TYPE.SCHEDULED);
|
|
25
|
-
// expect(taskData.status).toBe(TASK_STATUS.PENDING);
|
|
26
|
-
// expect(taskData.amountOfRetries).toBe(0);
|
|
27
|
-
// expect(taskData.parentTaskId).toBeUndefined();
|
|
28
|
-
// expect(taskData.name).toBe(TASKS.TEST_TASK.name);
|
|
9
|
+
const randomPosition = getRandomPosition(wixDataResponse.data.result.content);
|
|
10
|
+
console.log("randomPosition: ", randomPosition);
|
|
11
|
+
expect(wixDataResponse.data.result.totalFound).toBeGreaterThan(0);
|
|
12
|
+
expect(wixDataResponse.data.result.content.length).toBeGreaterThan(0);
|
|
13
|
+
expect(randomPosition.id.length).toBeGreaterThan(0);
|
|
14
|
+
expect(randomPosition.name.length).toBeGreaterThan(0);
|
|
15
|
+
expect(randomPosition.jobAdId.length).toBeGreaterThan(0);
|
|
16
|
+
expect(randomPosition.location).toBeDefined();
|
|
17
|
+
expect(randomPosition.department).toBeDefined();
|
|
29
18
|
});
|
|
30
19
|
|
|
31
|
-
// test('should return 500 error when scheduling task with invalid data', async () => {
|
|
32
|
-
// try {
|
|
33
|
-
// const response = await scheduleTask("");
|
|
34
|
-
// expect(response.status).not.toBe(200);
|
|
35
|
-
|
|
36
|
-
// } catch (error) {
|
|
37
|
-
// // Check if it's an HTTP error (from Axios) or an assertion error (from Jest)
|
|
38
|
-
// if (error.response) {
|
|
39
|
-
// // HTTP error from server
|
|
40
|
-
// expect(error.response.status).toBe(500);
|
|
41
|
-
// expect(error.response.data.message).toBe('[insertNewTask] Failed for Task TestTask with error [insertNewTask] Invalid params: {\"name\":\"TestTask\",\"data\":\"\",\"type\":\"scheduled\"}');
|
|
42
|
-
// } else {
|
|
43
|
-
// // Re-throw assertion errors or other unexpected errors
|
|
44
|
-
// throw error;
|
|
45
|
-
// }
|
|
46
|
-
// }
|
|
47
|
-
// });
|
|
48
|
-
});
|
|
49
20
|
|
|
50
21
|
|
|
51
22
|
});
|