@truedat/se 8.6.7 → 8.7.1
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 +4 -4
- package/src/components/DeleteIndexButton.js +1 -1
- package/src/components/__tests__/DeleteIndexButton.spec.js +3 -3
- package/src/components/__tests__/ElasticIndexes.spec.js +1 -1
- package/src/components/__tests__/SearchLoader.spec.js +1 -1
- package/src/components/__tests__/SearchRoutes.spec.js +4 -4
- package/src/components/__tests__/SearchTabs.spec.js +1 -1
- package/src/components/__tests__/SearchTabsHide.spec.js +1 -1
- package/src/hooks/useElasticIndexes.js +1 -1
- package/src/messages/index.js +1 -1
- package/src/reducers/__tests__/searchCount.spec.js +2 -2
- package/src/reducers/__tests__/searchLoading.spec.js +3 -3
- package/src/reducers/__tests__/searchQuery.spec.js +7 -7
- package/src/reducers/__tests__/searchResults.spec.js +6 -6
- package/src/reducers/searchQuery.js +1 -1
- package/src/sagas/__tests__/fetchSearch.spec.js +3 -3
- package/src/sagas/fetchSearch.js +1 -1
- package/src/selectors/getSearchQuery.js +1 -1
- package/src/selectors/searchIndicesSelector.js +1 -1
- package/src/selectors/searchResultsSelector.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/se",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Truedat Web Search Engine",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
52
52
|
"@testing-library/react": "^16.3.0",
|
|
53
53
|
"@testing-library/user-event": "^14.6.1",
|
|
54
|
-
"@truedat/test": "8.
|
|
54
|
+
"@truedat/test": "8.7.1",
|
|
55
55
|
"identity-obj-proxy": "^3.0.0",
|
|
56
56
|
"jest": "^29.7.0",
|
|
57
57
|
"redux-saga-test-plan": "^4.0.6"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@apollo/client": "^3.13.8",
|
|
61
|
-
"@truedat/core": "8.
|
|
61
|
+
"@truedat/core": "8.7.1",
|
|
62
62
|
"axios": "^1.15.0",
|
|
63
63
|
"graphql": "^16.11.0",
|
|
64
64
|
"is-hotkey": "^0.2.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
85
85
|
"swr": "^2.3.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "f7605a6ea3f78839b42bb7d8339eec125ba49acb"
|
|
88
88
|
}
|
|
@@ -5,7 +5,7 @@ import DeleteIndexButton from "../DeleteIndexButton";
|
|
|
5
5
|
|
|
6
6
|
jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
7
7
|
const originalModule = jest.requireActual(
|
|
8
|
-
"@truedat/se/hooks/useElasticIndexes"
|
|
8
|
+
"@truedat/se/hooks/useElasticIndexes",
|
|
9
9
|
);
|
|
10
10
|
const trigger = jest.fn();
|
|
11
11
|
return {
|
|
@@ -34,7 +34,7 @@ describe("<DeleteIndexButton />", () => {
|
|
|
34
34
|
|
|
35
35
|
await user.click(rendered.getByRole("button", { name: /delete/i }));
|
|
36
36
|
await user.click(
|
|
37
|
-
rendered.getByRole("button", { name: "modal-affirmative-action" })
|
|
37
|
+
rendered.getByRole("button", { name: "modal-affirmative-action" }),
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
expect(useElasticIndexDelete).toHaveBeenCalledWith(indexName);
|
|
@@ -50,7 +50,7 @@ describe("<DeleteIndexButton />", () => {
|
|
|
50
50
|
|
|
51
51
|
await user.click(rendered.getByRole("button", { name: /delete/i }));
|
|
52
52
|
await user.click(
|
|
53
|
-
rendered.getByRole("button", { name: "modal-negative-action" })
|
|
53
|
+
rendered.getByRole("button", { name: "modal-negative-action" }),
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
expect(useElasticIndexDelete).toHaveBeenCalledWith(indexName);
|
|
@@ -3,7 +3,7 @@ import ElasticIndexes from "../ElasticIndexes";
|
|
|
3
3
|
|
|
4
4
|
jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
5
5
|
const originalModule = jest.requireActual(
|
|
6
|
-
"@truedat/se/hooks/useElasticIndexes"
|
|
6
|
+
"@truedat/se/hooks/useElasticIndexes",
|
|
7
7
|
);
|
|
8
8
|
return {
|
|
9
9
|
__esModule: true,
|
|
@@ -48,7 +48,7 @@ describe("<SearchLoader />", () => {
|
|
|
48
48
|
|
|
49
49
|
// Verify updateSearchPath and fetchSearch were called on mount
|
|
50
50
|
expect(mockDispatch).toHaveBeenCalledWith(
|
|
51
|
-
updateSearchPath(expect.objectContaining({ path: expect.any(String) }))
|
|
51
|
+
updateSearchPath(expect.objectContaining({ path: expect.any(String) })),
|
|
52
52
|
);
|
|
53
53
|
expect(mockDispatch).toHaveBeenCalledWith(fetchSearch({}));
|
|
54
54
|
|
|
@@ -18,28 +18,28 @@ jest.mock(
|
|
|
18
18
|
() =>
|
|
19
19
|
function SearchLoader() {
|
|
20
20
|
return <div>SearchLoader</div>;
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
22
|
);
|
|
23
23
|
jest.mock(
|
|
24
24
|
"../SearchHome",
|
|
25
25
|
() =>
|
|
26
26
|
function SearchHome() {
|
|
27
27
|
return <div>SearchHome</div>;
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
29
|
);
|
|
30
30
|
jest.mock(
|
|
31
31
|
"../Search",
|
|
32
32
|
() =>
|
|
33
33
|
function Search() {
|
|
34
34
|
return <div>Search</div>;
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
);
|
|
37
37
|
jest.mock(
|
|
38
38
|
"../ElasticIndexes",
|
|
39
39
|
() =>
|
|
40
40
|
function ElasticIndexes() {
|
|
41
41
|
return <div>ElasticIndexes</div>;
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
43
|
);
|
|
44
44
|
jest.mock("@truedat/core/components", () => ({
|
|
45
45
|
Unauthorized: () => <div>Unauthorized</div>,
|
|
@@ -5,7 +5,7 @@ import { SearchTabs } from "../SearchTabs";
|
|
|
5
5
|
jest.mock("@truedat/core/hooks", () => ({
|
|
6
6
|
useAuthorized: jest.fn(() => true),
|
|
7
7
|
useActiveRoute: jest.fn((param) =>
|
|
8
|
-
param === "/search/results" ? true : false
|
|
8
|
+
param === "/search/results" ? true : false,
|
|
9
9
|
),
|
|
10
10
|
}));
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import { SearchTabs } from "../SearchTabs";
|
|
|
4
4
|
jest.mock("@truedat/core/hooks", () => ({
|
|
5
5
|
useAuthorized: jest.fn(
|
|
6
6
|
(params) =>
|
|
7
|
-
params.includes("all") || params.includes("business_glossary_view")
|
|
7
|
+
params.includes("all") || params.includes("business_glossary_view"),
|
|
8
8
|
),
|
|
9
9
|
useActiveRoute: jest.fn((params) => params === "/search/results"),
|
|
10
10
|
}));
|
package/src/messages/index.js
CHANGED
|
@@ -13,13 +13,13 @@ describe("reducers: searchCount", () => {
|
|
|
13
13
|
it("should handle the fetchSearch.SUCCESS action", () => {
|
|
14
14
|
const payload = { headers: { "x-total-count": 6 } };
|
|
15
15
|
expect(
|
|
16
|
-
searchCount(fooState, { type: fetchSearch.SUCCESS, payload })
|
|
16
|
+
searchCount(fooState, { type: fetchSearch.SUCCESS, payload }),
|
|
17
17
|
).toEqual(6);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
it("should handle the clearSearch.TRIGGER action", () => {
|
|
21
21
|
expect(searchCount(fooState, { type: clearSearch.TRIGGER })).toEqual(
|
|
22
|
-
initialState
|
|
22
|
+
initialState,
|
|
23
23
|
);
|
|
24
24
|
});
|
|
25
25
|
});
|
|
@@ -12,19 +12,19 @@ describe("reducers: searchLoading", () => {
|
|
|
12
12
|
|
|
13
13
|
it("should handle the fetchSearch.REQUEST action", () => {
|
|
14
14
|
expect(searchLoading(fooState, { type: fetchSearch.REQUEST })).toEqual(
|
|
15
|
-
true
|
|
15
|
+
true,
|
|
16
16
|
);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it("should handle the fetchSearch.SUCCESS action", () => {
|
|
20
20
|
expect(searchLoading(fooState, { type: fetchSearch.SUCCESS })).toEqual(
|
|
21
|
-
false
|
|
21
|
+
false,
|
|
22
22
|
);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should handle the fetchSearch.FAILURE action", () => {
|
|
26
26
|
expect(searchLoading(fooState, { type: fetchSearch.FAILURE })).toEqual(
|
|
27
|
-
false
|
|
27
|
+
false,
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchSearch,
|
|
3
3
|
updateSearchPath,
|
|
4
|
-
selectSearchPage
|
|
4
|
+
selectSearchPage,
|
|
5
5
|
} from "../../routines";
|
|
6
6
|
import { searchQuery } from "..";
|
|
7
7
|
|
|
@@ -19,18 +19,18 @@ describe("reducers: searchQuery", () => {
|
|
|
19
19
|
expect(
|
|
20
20
|
searchQuery(fooState, {
|
|
21
21
|
type: updateSearchPath.TRIGGER,
|
|
22
|
-
payload: { path }
|
|
23
|
-
})
|
|
22
|
+
payload: { path },
|
|
23
|
+
}),
|
|
24
24
|
).toEqual({
|
|
25
25
|
...fooState,
|
|
26
|
-
path
|
|
26
|
+
path,
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it("should handle the fetchSearch.TRIGGER action", () => {
|
|
31
31
|
const query = "My Query";
|
|
32
32
|
expect(
|
|
33
|
-
searchQuery(fooState, { type: fetchSearch.TRIGGER, payload: { query } })
|
|
33
|
+
searchQuery(fooState, { type: fetchSearch.TRIGGER, payload: { query } }),
|
|
34
34
|
).toEqual({ ...fooState, page: 1, query });
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -39,8 +39,8 @@ describe("reducers: searchQuery", () => {
|
|
|
39
39
|
expect(
|
|
40
40
|
searchQuery(fooState, {
|
|
41
41
|
type: selectSearchPage.TRIGGER,
|
|
42
|
-
payload: { activePage }
|
|
43
|
-
})
|
|
42
|
+
payload: { activePage },
|
|
43
|
+
}),
|
|
44
44
|
).toEqual({ ...fooState, page: activePage });
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -12,19 +12,19 @@ describe("reducers: searchResults", () => {
|
|
|
12
12
|
|
|
13
13
|
it("should handle the clearSearch.TRIGGER action", () => {
|
|
14
14
|
expect(searchResults(fooState, { type: clearSearch.TRIGGER })).toEqual(
|
|
15
|
-
initialState
|
|
15
|
+
initialState,
|
|
16
16
|
);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
it("should handle the fetchSearch.TRIGGER action", () => {
|
|
20
20
|
expect(searchResults(fooState, { type: fetchSearch.TRIGGER })).toEqual(
|
|
21
|
-
initialState
|
|
21
|
+
initialState,
|
|
22
22
|
);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should handle the fetchSearch.TRIGGER action", () => {
|
|
26
26
|
expect(searchResults(fooState, { type: fetchSearch.TRIGGER })).toEqual(
|
|
27
|
-
initialState
|
|
27
|
+
initialState,
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -32,13 +32,13 @@ describe("reducers: searchResults", () => {
|
|
|
32
32
|
const searchItems = [
|
|
33
33
|
{ resuts: [{ id: 1, name: "BC 1" }], index: "business_concept" },
|
|
34
34
|
{ resuts: [{ id: 2, name: "DS 1" }], index: "data_structure" },
|
|
35
|
-
{ resuts: [{ id: 3, name: "IG 1" }], index: "ingest" }
|
|
35
|
+
{ resuts: [{ id: 3, name: "IG 1" }], index: "ingest" },
|
|
36
36
|
];
|
|
37
37
|
const data = {
|
|
38
|
-
data: searchItems
|
|
38
|
+
data: searchItems,
|
|
39
39
|
};
|
|
40
40
|
expect(
|
|
41
|
-
searchResults(fooState, { type: fetchSearch.SUCCESS, payload: { data } })
|
|
41
|
+
searchResults(fooState, { type: fetchSearch.SUCCESS, payload: { data } }),
|
|
42
42
|
).toEqual(searchItems);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -13,7 +13,7 @@ describe("sagas: fetchSearchRequestSaga", () => {
|
|
|
13
13
|
.next()
|
|
14
14
|
.all([
|
|
15
15
|
takeLatest(fetchSearch.TRIGGER, fetchSearchSaga),
|
|
16
|
-
takeLatest(selectSearchPage.TRIGGER, fetchSearchSaga)
|
|
16
|
+
takeLatest(selectSearchPage.TRIGGER, fetchSearchSaga),
|
|
17
17
|
])
|
|
18
18
|
.finish()
|
|
19
19
|
.isDone();
|
|
@@ -32,10 +32,10 @@ describe("sagas: fetchSearchRequestSaga", () => {
|
|
|
32
32
|
describe("sagas: fetchConceptsSaga", () => {
|
|
33
33
|
const searchQuery = {};
|
|
34
34
|
const data = [
|
|
35
|
-
{ index: "business_concept", results: [{ id: 1, name: "my term" }] }
|
|
35
|
+
{ index: "business_concept", results: [{ id: 1, name: "my term" }] },
|
|
36
36
|
];
|
|
37
37
|
const headers = {
|
|
38
|
-
"x-total-count": "1"
|
|
38
|
+
"x-total-count": "1",
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
it("should pass the query parameter to the API with 200ms delay", () => {
|
package/src/sagas/fetchSearch.js
CHANGED
|
@@ -27,6 +27,6 @@ export function* fetchSearchSaga() {
|
|
|
27
27
|
export function* fetchSearchRequestSaga() {
|
|
28
28
|
yield all([
|
|
29
29
|
takeLatest(fetchSearch.TRIGGER, fetchSearchSaga),
|
|
30
|
-
takeLatest(selectSearchPage.TRIGGER, fetchSearchSaga)
|
|
30
|
+
takeLatest(selectSearchPage.TRIGGER, fetchSearchSaga),
|
|
31
31
|
]);
|
|
32
32
|
}
|
|
@@ -25,6 +25,6 @@ export const searchResultsSelector = createSelector(
|
|
|
25
25
|
_.flow(
|
|
26
26
|
_.reduce((acc, el) => [...acc, ..._.propOr([], "results")(el)], []),
|
|
27
27
|
_.orderBy(["index"], ["asc"]),
|
|
28
|
-
_.map((item) => ({ ...item, to: indexUrl(item) }))
|
|
29
|
-
)(searchResults)
|
|
28
|
+
_.map((item) => ({ ...item, to: indexUrl(item) })),
|
|
29
|
+
)(searchResults),
|
|
30
30
|
);
|