@eeacms/volto-globalsearch 2.1.2 → 4.0.0
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/CHANGELOG.md +22 -20
- package/DEVELOP.md +19 -17
- package/README.md +33 -19
- package/docker-compose.yml +1 -1
- package/jest-addon.config.js +11 -4
- package/locales/bg/LC_MESSAGES/volto.po +7 -7
- package/locales/cs/LC_MESSAGES/volto.po +7 -7
- package/locales/de/LC_MESSAGES/volto.po +7 -7
- package/locales/en/LC_MESSAGES/volto.po +7 -7
- package/locales/es/LC_MESSAGES/volto.po +7 -7
- package/locales/et/LC_MESSAGES/volto.po +7 -7
- package/locales/fi/LC_MESSAGES/volto.po +7 -7
- package/locales/fr/LC_MESSAGES/volto.po +7 -7
- package/locales/ga/LC_MESSAGES/volto.po +7 -7
- package/locales/hr/LC_MESSAGES/volto.po +7 -7
- package/locales/hu/LC_MESSAGES/volto.po +7 -7
- package/locales/it/LC_MESSAGES/volto.po +7 -7
- package/locales/lt/LC_MESSAGES/volto.po +7 -7
- package/locales/nl/LC_MESSAGES/volto.po +7 -7
- package/locales/pl/LC_MESSAGES/volto.po +7 -7
- package/locales/pt/LC_MESSAGES/volto.po +7 -7
- package/locales/ro/LC_MESSAGES/volto.po +7 -7
- package/locales/sl/LC_MESSAGES/volto.po +7 -7
- package/locales/volto.pot +9 -9
- package/package.json +2 -1
- package/src/components/MasonryLandingPage.test.jsx +1 -1
- package/src/config/clusters.test.js +221 -0
- package/src/config/filters.test.js +67 -0
- package/src/config/healthcheck.js +10 -60
- package/src/config/healthcheck.test.js +18 -13
- package/src/config/healthcheck_queries/failed_scheduled_atempts_since_last_started.json +1 -2
- package/src/config/healthcheck_queries/last_scheduled_started_indexing.json +1 -2
- package/src/config/healthcheck_queries/last_sync_task_since_last_start.json +1 -2
- package/src/config/healthcheck_queries/latest_tasks_for_site.json +1 -2
- package/src/config/healthcheck_queries/started_or_finished_site_since_last_started.json +1 -2
- package/src/config/index.test.js +1 -1
- package/src/config/query.test.js +64 -0
- package/src/config/vocabulary.test.js +92 -0
- package/src/index.test.js +74 -0
- package/src/utils.test.js +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import vocabWrapper from './vocabulary';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
|
|
4
|
+
describe('vocabulary', () => {
|
|
5
|
+
it('should export vocab wrapper object', () => {
|
|
6
|
+
expect(vocabWrapper).toBeDefined();
|
|
7
|
+
expect(vocabWrapper.vocab).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should have language vocabulary', () => {
|
|
11
|
+
expect(vocabWrapper.vocab.language).toBeDefined();
|
|
12
|
+
expect(typeof vocabWrapper.vocab.language).toBe('object');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should have cluster_name vocabulary', () => {
|
|
16
|
+
expect(vocabWrapper.vocab.cluster_name).toBeDefined();
|
|
17
|
+
expect(typeof vocabWrapper.vocab.cluster_name).toBe('object');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should have English language entry', () => {
|
|
21
|
+
expect(vocabWrapper.vocab.language.en).toBe('English (en)');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should have eea cluster name', () => {
|
|
25
|
+
expect(vocabWrapper.vocab.cluster_name.eea).toBe(
|
|
26
|
+
'European Environment Agency',
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should have all expected languages', () => {
|
|
31
|
+
const expectedLanguages = [
|
|
32
|
+
'ar',
|
|
33
|
+
'bg',
|
|
34
|
+
'bs',
|
|
35
|
+
'cs',
|
|
36
|
+
'da',
|
|
37
|
+
'de',
|
|
38
|
+
'el',
|
|
39
|
+
'en',
|
|
40
|
+
'es',
|
|
41
|
+
'et',
|
|
42
|
+
'fi',
|
|
43
|
+
'fr',
|
|
44
|
+
'ga',
|
|
45
|
+
'hr',
|
|
46
|
+
'hu',
|
|
47
|
+
'is',
|
|
48
|
+
'it',
|
|
49
|
+
'lt',
|
|
50
|
+
'lv',
|
|
51
|
+
'mk',
|
|
52
|
+
'mt',
|
|
53
|
+
'nl',
|
|
54
|
+
'no',
|
|
55
|
+
'pl',
|
|
56
|
+
'pt',
|
|
57
|
+
'ro',
|
|
58
|
+
'ru',
|
|
59
|
+
'sk',
|
|
60
|
+
'sl',
|
|
61
|
+
'sq',
|
|
62
|
+
'sr',
|
|
63
|
+
'sv',
|
|
64
|
+
'tr',
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
expectedLanguages.forEach((lang) => {
|
|
68
|
+
expect(vocabWrapper.vocab.language[lang]).toBeDefined();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should have all expected cluster names', () => {
|
|
73
|
+
const expectedClusters = [
|
|
74
|
+
'eea',
|
|
75
|
+
'fise',
|
|
76
|
+
'bise',
|
|
77
|
+
'industry',
|
|
78
|
+
'energy',
|
|
79
|
+
'cca',
|
|
80
|
+
'ias',
|
|
81
|
+
'wise-freshwater',
|
|
82
|
+
'wise-marine',
|
|
83
|
+
'etc',
|
|
84
|
+
'sdi',
|
|
85
|
+
'cab',
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
expectedClusters.forEach((cluster) => {
|
|
89
|
+
expect(vocabWrapper.vocab.cluster_name[cluster]).toBeDefined();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import applyConfig from './index';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
|
|
4
|
+
jest.mock('./config', () =>
|
|
5
|
+
jest.fn((registry) => ({
|
|
6
|
+
...registry,
|
|
7
|
+
searchui: {
|
|
8
|
+
...registry.searchui,
|
|
9
|
+
globalsearch: { id: 'globalsearch' },
|
|
10
|
+
globalsearchbase: { id: 'globalsearchbase' },
|
|
11
|
+
},
|
|
12
|
+
})),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
describe('volto-globalsearch applyConfig', () => {
|
|
16
|
+
let config;
|
|
17
|
+
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
config = {
|
|
20
|
+
settings: {
|
|
21
|
+
searchlib: {
|
|
22
|
+
searchui: {
|
|
23
|
+
default: {},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should apply the globalsearch configuration', () => {
|
|
31
|
+
const result = applyConfig(config);
|
|
32
|
+
|
|
33
|
+
expect(result.settings.searchlib.searchui.globalsearch).toBeDefined();
|
|
34
|
+
expect(result.settings.searchlib.searchui.globalsearchbase).toBeDefined();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should set elastic_index for globalsearch', () => {
|
|
38
|
+
const result = applyConfig(config);
|
|
39
|
+
|
|
40
|
+
expect(result.settings.searchlib.searchui.globalsearch.elastic_index).toBe(
|
|
41
|
+
'_es/globalsearch',
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should set index_name for globalsearch', () => {
|
|
46
|
+
const result = applyConfig(config);
|
|
47
|
+
|
|
48
|
+
expect(result.settings.searchlib.searchui.globalsearch.index_name).toBe(
|
|
49
|
+
'data_searchui',
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should set elastic_index for globalsearchbase', () => {
|
|
54
|
+
const result = applyConfig(config);
|
|
55
|
+
|
|
56
|
+
expect(
|
|
57
|
+
result.settings.searchlib.searchui.globalsearchbase.elastic_index,
|
|
58
|
+
).toBe('_es/globalsearch');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should set index_name for globalsearchbase', () => {
|
|
62
|
+
const result = applyConfig(config);
|
|
63
|
+
|
|
64
|
+
expect(result.settings.searchlib.searchui.globalsearchbase.index_name).toBe(
|
|
65
|
+
'data_searchui',
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should return the modified config', () => {
|
|
70
|
+
const result = applyConfig(config);
|
|
71
|
+
|
|
72
|
+
expect(result).toBe(config);
|
|
73
|
+
});
|
|
74
|
+
});
|
package/src/utils.test.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
get_cluster_icons,
|
|
7
7
|
get_cluster_icons_dict,
|
|
8
8
|
} from './utils';
|
|
9
|
-
import '@testing-library/jest-dom
|
|
9
|
+
import '@testing-library/jest-dom';
|
|
10
10
|
|
|
11
11
|
describe('build_runtime_mappings', () => {
|
|
12
12
|
it('should build runtime mappings based on settings', () => {
|