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