sr-npm 1.7.1049 → 1.7.1051
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
package/pages/homePage.js
CHANGED
|
@@ -16,6 +16,7 @@ async function homePageOnReady(_$w,thisObject=null) {
|
|
|
16
16
|
const queryResult = await wixData.query(COLLECTIONS.SITE_CONFIGS).find();
|
|
17
17
|
const siteconfig = queryResult.items[0];
|
|
18
18
|
if(siteconfig.categorySearch==="true") {
|
|
19
|
+
|
|
19
20
|
const allJobs=await getAllRecords(COLLECTIONS.JOBS);
|
|
20
21
|
const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
21
22
|
bindPrimarySearch(_$w,allvaluesobjects,allJobs);
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
jest.mock('wix-location-frontend');
|
|
2
|
+
jest.mock('@wix/site-location', () => ({
|
|
3
|
+
location: {
|
|
4
|
+
to: jest.fn()
|
|
5
|
+
}
|
|
6
|
+
}));
|
|
7
|
+
jest.mock('@wix/data', () => ({
|
|
8
|
+
items: {
|
|
9
|
+
query: jest.fn(() => ({
|
|
10
|
+
eq: jest.fn().mockReturnThis(),
|
|
11
|
+
find: jest.fn().mockResolvedValue({ items: [] }),
|
|
12
|
+
include: jest.fn().mockReturnThis(),
|
|
13
|
+
hasSome: jest.fn().mockReturnThis(),
|
|
14
|
+
ne: jest.fn().mockReturnThis(),
|
|
15
|
+
limit: jest.fn().mockReturnThis()
|
|
16
|
+
})),
|
|
17
|
+
queryReferenced: jest.fn()
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
1
20
|
const rewire = require('rewire');
|
|
2
21
|
const MockJobBuilder = require('./mockJobBuilder');
|
|
3
22
|
const { CAREERS_MULTI_BOXES_PAGE_CONSTS, CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
|
|
@@ -9,7 +28,13 @@ const pagesUtils = rewire('../pages/pagesUtils');
|
|
|
9
28
|
const secondarySearch = careersMultiBoxesPage.__get__('secondarySearch');
|
|
10
29
|
const primarySearch = pagesUtils.__get__('primarySearch');
|
|
11
30
|
const loadCategoriesListPrimarySearch = pagesUtils.__get__('loadCategoriesListPrimarySearch');
|
|
12
|
-
|
|
31
|
+
const mockQueryParams = {
|
|
32
|
+
add: jest.fn(),
|
|
33
|
+
remove: jest.fn()
|
|
34
|
+
};
|
|
35
|
+
const mockOnChange = jest.fn();
|
|
36
|
+
careersMultiBoxesPage.__set__('queryParams', mockQueryParams);
|
|
37
|
+
careersMultiBoxesPage.__set__('onChange', mockOnChange);
|
|
13
38
|
|
|
14
39
|
describe('secondarySearch function tests', () => {
|
|
15
40
|
let mockW;
|
|
@@ -79,13 +104,11 @@ describe('secondarySearch function tests', () => {
|
|
|
79
104
|
mockJobs.push(new MockJobBuilder().withTitle('Frontend Engineer').build());
|
|
80
105
|
|
|
81
106
|
careersMultiBoxesPage.__set__('currentJobs', mockJobs);
|
|
82
|
-
|
|
83
107
|
const result = await secondarySearch(mockW, 'product');
|
|
84
|
-
|
|
85
108
|
expect(result.length).toBe(11);
|
|
86
109
|
expect(mockTotalJobsCountText.text).toContain('11');
|
|
87
|
-
expect(mockPaginationCurrentText.text).toBe('
|
|
88
|
-
expect(mockPaginationTotalCountText.text).toBe('
|
|
110
|
+
expect(mockPaginationCurrentText.text).toBe('1');
|
|
111
|
+
expect(mockPaginationTotalCountText.text).toBe('2');
|
|
89
112
|
expect(mockPageButtonNext.enable).toHaveBeenCalled();
|
|
90
113
|
expect(mockPageButtonPrevious.disable).toHaveBeenCalled();
|
|
91
114
|
});
|