@truedat/dd 6.6.0 → 6.6.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 +6 -6
- package/src/components/CatalogCustomViewCards.js +9 -32
- package/src/components/DictionaryRoutes.js +1 -9
- package/src/components/GrantRemovalDirectButton.js +1 -3
- package/src/components/GrantRequestCancel.js +1 -1
- package/src/components/GrantRoutes.js +1 -14
- package/src/components/StructureGrantListButton.js +4 -4
- package/src/components/StructureSelector.js +70 -44
- package/src/components/StructureStructureForm.js +1 -1
- package/src/components/StructuresBulkUpdate.js +10 -14
- package/src/components/StructuresDownloadOption.js +31 -27
- package/src/components/StructuresEditableDownloadOption.js +12 -7
- package/src/components/StructuresGrantRequestView.js +55 -24
- package/src/components/StructuresLabelResults.js +5 -11
- package/src/components/StructuresPagination.js +13 -15
- package/src/components/StructuresRoutes.js +2 -18
- package/src/components/StructuresTable.js +79 -115
- package/src/components/StructuresUpdateOption.js +77 -9
- package/src/components/StructuresView.js +67 -52
- package/src/components/__tests__/CatalogCustomViewCards.spec.js +44 -7
- package/src/components/__tests__/StructureGrantListButton.spec.js +27 -17
- package/src/components/__tests__/StructureSelector.spec.js +70 -25
- package/src/components/__tests__/StructureStructureForm.spec.js +92 -60
- package/src/components/__tests__/StructureStructureLinks.spec.js +1 -1
- package/src/components/__tests__/StructuresBulkUpdate.spec.js +26 -14
- package/src/components/__tests__/StructuresDownloadOption.spec.js +38 -5
- package/src/components/__tests__/StructuresEditableDownloadOption.spec.js +20 -8
- package/src/components/__tests__/StructuresGrantRequestView.spec.js +43 -15
- package/src/components/__tests__/StructuresLabelResults.spec.js +37 -10
- package/src/components/__tests__/StructuresOptions.spec.js +62 -1
- package/src/components/__tests__/StructuresSearchResults.spec.js +67 -12
- package/src/components/__tests__/StructuresTable.spec.js +77 -88
- package/src/components/__tests__/StructuresUpdateOption.spec.js +53 -6
- package/src/components/__tests__/StructuresView.spec.js +126 -31
- package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +206 -42
- package/src/components/__tests__/__snapshots__/StructuresDownloadOption.spec.js.snap +17 -0
- package/src/components/__tests__/__snapshots__/StructuresGrantRequestView.spec.js.snap +68 -5
- package/src/components/__tests__/__snapshots__/StructuresLabelResults.spec.js.snap +7 -12
- package/src/components/__tests__/__snapshots__/StructuresSearchResults.spec.js.snap +72 -27
- package/src/components/__tests__/__snapshots__/StructuresTable.spec.js.snap +226 -153
- package/src/components/__tests__/__snapshots__/StructuresUpdateOption.spec.js.snap +3 -3
- package/src/components/index.js +0 -8
- package/src/hooks/useStructures.js +6 -6
- package/src/reducers/__tests__/selectedUserSearchFilter.spec.js +2 -23
- package/src/reducers/__tests__/structureQuery.spec.js +1 -63
- package/src/reducers/index.js +0 -18
- package/src/reducers/previousStructureQuery.js +3 -6
- package/src/reducers/selectedUserSearchFilter.js +1 -10
- package/src/reducers/structureQuery.js +1 -33
- package/src/routines.js +1 -15
- package/src/sagas/__tests__/bulkUpdateStructures.spec.js +7 -7
- package/src/sagas/__tests__/downloadEditableStructures.spec.js +1 -6
- package/src/sagas/__tests__/downloadStructures.spec.js +2 -7
- package/src/sagas/__tests__/fetchStructures.spec.js +4 -4
- package/src/sagas/bulkUpdateStructures.js +6 -4
- package/src/sagas/downloadEditableStructures.js +2 -3
- package/src/sagas/downloadStructures.js +2 -3
- package/src/sagas/index.js +0 -3
- package/src/selectors/__tests__/getGrantSelectedFilters.spec.js +1 -1
- package/src/selectors/__tests__/structureColumnsSelector.spec.js +5 -19
- package/src/selectors/__tests__/templateNamesSelector.spec.js +19 -0
- package/src/selectors/index.js +1 -8
- package/src/selectors/structureColumnsSelector.js +6 -46
- package/src/selectors/templateNamesSelector.js +7 -0
- package/src/utils/structureCustomTranslations.js +19 -0
- package/src/components/StructureDateFilter.js +0 -32
- package/src/components/StructureFilters.js +0 -19
- package/src/components/StructureFiltersLoader.js +0 -32
- package/src/components/StructureSelectedFilters.js +0 -94
- package/src/components/__tests__/StructureDateFilter.spec.js +0 -11
- package/src/components/__tests__/__snapshots__/StructureDateFilter.spec.js.snap +0 -13
- package/src/reducers/__tests__/structureActiveFilters.spec.js +0 -100
- package/src/reducers/__tests__/structureDateFilter.spec.js +0 -57
- package/src/reducers/__tests__/structureFilters.spec.js +0 -37
- package/src/reducers/__tests__/structureUserFilters.spec.js +0 -76
- package/src/reducers/__tests__/structuresActions.spec.js +0 -38
- package/src/reducers/__tests__/structuresLoading.spec.js +0 -26
- package/src/reducers/structureActiveFilters.js +0 -58
- package/src/reducers/structureCount.js +0 -20
- package/src/reducers/structureDateFilter.js +0 -33
- package/src/reducers/structureFilters.js +0 -21
- package/src/reducers/structureFiltersLoading.js +0 -14
- package/src/reducers/structureSelectedFilter.js +0 -34
- package/src/reducers/structuresActions.js +0 -18
- package/src/reducers/structuresLoading.js +0 -14
- package/src/reducers/structuresPageSize.js +0 -15
- package/src/sagas/fetchStructureFilters.js +0 -29
- package/src/selectors/__tests__/bulkUpdateDisabledSelector.spec.js +0 -72
- package/src/selectors/__tests__/getStructureAvailableFilters.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilterActiveValues.spec.js +0 -20
- package/src/selectors/__tests__/getStructureSelectedFilterValues.spec.js +0 -15
- package/src/selectors/__tests__/getStructureSelectedFilters.spec.js +0 -15
- package/src/selectors/bulkUpdateDisabledSelector.js +0 -46
- package/src/selectors/getPreviousStructureQuery.js +0 -2
- package/src/selectors/getStructureAvailableFilters.js +0 -15
- package/src/selectors/getStructureFilterTypes.js +0 -7
- package/src/selectors/getStructureSelectedFilterActiveValues.js +0 -9
- package/src/selectors/getStructureSelectedFilterValues.js +0 -12
- package/src/selectors/getStructureSelectedFilters.js +0 -7
|
@@ -1,131 +1,120 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { waitFor } from "@testing-library/react";
|
|
4
|
+
import userEvent from "@testing-library/user-event";
|
|
5
|
+
import SearchContext from "@truedat/core/search/SearchContext";
|
|
3
6
|
import { StructuresTable } from "../StructuresTable";
|
|
4
7
|
|
|
8
|
+
const structures = { data: [1, 2, 3].map((id) => ({ id, foo: id, bar: id })) };
|
|
9
|
+
const handleSortSelection = jest.fn();
|
|
10
|
+
|
|
11
|
+
const searchProps = {
|
|
12
|
+
searchData: structures,
|
|
13
|
+
sortColumn: "name.raw",
|
|
14
|
+
sortDirection: "descending",
|
|
15
|
+
handleSortSelection,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const renderOpts = {
|
|
19
|
+
messages: {
|
|
20
|
+
en: {
|
|
21
|
+
"structure.bar": "Bar",
|
|
22
|
+
"structure.foo": "Foo",
|
|
23
|
+
"structure.name": "Structure",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
5
28
|
describe("<StructuresTable />", () => {
|
|
6
|
-
const structures = [1, 2, 3].map(id => ({ id }));
|
|
7
29
|
const columns = [
|
|
8
30
|
{ name: "foo", sort: { name: "name.raw" } },
|
|
9
|
-
{ name: "bar", sort: { name: "bar.raw" } }
|
|
31
|
+
{ name: "bar", sort: { name: "bar.raw" } },
|
|
10
32
|
];
|
|
11
33
|
const size = "small";
|
|
12
|
-
const structuresSort = [{ "name.raw": "desc" }];
|
|
13
34
|
|
|
14
35
|
it("matches the latest snapshot", () => {
|
|
15
36
|
const onStructureSelected = jest.fn();
|
|
16
|
-
const props = {
|
|
17
|
-
const
|
|
18
|
-
|
|
37
|
+
const props = { columns, size, onStructureSelected };
|
|
38
|
+
const { container } = render(
|
|
39
|
+
<SearchContext.Provider value={searchProps}>
|
|
40
|
+
<StructuresTable {...props} />
|
|
41
|
+
</SearchContext.Provider>,
|
|
42
|
+
renderOpts
|
|
43
|
+
);
|
|
44
|
+
expect(container).toMatchSnapshot();
|
|
19
45
|
});
|
|
20
46
|
|
|
21
47
|
it("matches the latest snapshot (selected structure active)", () => {
|
|
22
48
|
const onStructureSelected = jest.fn();
|
|
23
49
|
const props = {
|
|
24
|
-
structures,
|
|
25
50
|
columns,
|
|
26
51
|
size,
|
|
27
52
|
onStructureSelected,
|
|
28
|
-
selectedStructure: { id: 2 }
|
|
53
|
+
selectedStructure: { id: 2 },
|
|
29
54
|
};
|
|
30
55
|
|
|
31
|
-
const
|
|
32
|
-
|
|
56
|
+
const { container } = render(
|
|
57
|
+
<SearchContext.Provider value={searchProps}>
|
|
58
|
+
<StructuresTable {...props} />
|
|
59
|
+
</SearchContext.Provider>,
|
|
60
|
+
renderOpts
|
|
61
|
+
);
|
|
62
|
+
expect(container).toMatchSnapshot();
|
|
33
63
|
});
|
|
34
64
|
|
|
35
65
|
it("matches the latest snapshot (selected structure not in structures)", () => {
|
|
36
66
|
const onStructureSelected = jest.fn();
|
|
37
67
|
const props = {
|
|
38
|
-
structures,
|
|
39
68
|
columns,
|
|
40
69
|
size,
|
|
41
70
|
onStructureSelected,
|
|
42
|
-
selectedStructure: { id: 42 }
|
|
71
|
+
selectedStructure: { id: 42 },
|
|
43
72
|
};
|
|
44
73
|
|
|
45
|
-
const
|
|
46
|
-
|
|
74
|
+
const { container } = render(
|
|
75
|
+
<SearchContext.Provider value={searchProps}>
|
|
76
|
+
<StructuresTable {...props} />
|
|
77
|
+
</SearchContext.Provider>,
|
|
78
|
+
renderOpts
|
|
79
|
+
);
|
|
80
|
+
expect(container).toMatchSnapshot();
|
|
47
81
|
});
|
|
48
82
|
|
|
49
83
|
it("sorts column in the direction specified", () => {
|
|
50
|
-
const sortStructures = jest.fn();
|
|
51
84
|
const props = {
|
|
52
|
-
structures,
|
|
53
85
|
columns,
|
|
54
86
|
size,
|
|
55
|
-
sortStructures,
|
|
56
|
-
structuresSort
|
|
57
87
|
};
|
|
58
|
-
const wrapper = shallowWithIntl(<StructuresTable {...props} />);
|
|
59
|
-
const tableHeaderCells = wrapper
|
|
60
|
-
.dive()
|
|
61
|
-
.find("TableHeader")
|
|
62
|
-
.find("TableRow")
|
|
63
|
-
.dive()
|
|
64
|
-
.find("TableHeaderCell");
|
|
65
|
-
|
|
66
|
-
expect(tableHeaderCells.at(0).props().sorted).toEqual("descending");
|
|
67
|
-
expect(tableHeaderCells.at(1).props().sorted).toEqual(null);
|
|
68
|
-
});
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.at(1)
|
|
82
|
-
.simulate("click");
|
|
83
|
-
|
|
84
|
-
expect(
|
|
85
|
-
wrapper
|
|
86
|
-
.dive()
|
|
87
|
-
.find("TableHeader")
|
|
88
|
-
.find("TableRow")
|
|
89
|
-
.dive()
|
|
90
|
-
.find("TableHeaderCell")
|
|
91
|
-
.at(1)
|
|
92
|
-
.props().sorted
|
|
93
|
-
).toEqual("ascending");
|
|
94
|
-
|
|
95
|
-
wrapper
|
|
96
|
-
.dive()
|
|
97
|
-
.find("TableHeader")
|
|
98
|
-
.find("TableRow")
|
|
99
|
-
.dive()
|
|
100
|
-
.find("TableHeaderCell")
|
|
101
|
-
.at(1)
|
|
102
|
-
.simulate("click");
|
|
103
|
-
expect(
|
|
104
|
-
wrapper
|
|
105
|
-
.dive()
|
|
106
|
-
.find("TableHeader")
|
|
107
|
-
.find("TableRow")
|
|
108
|
-
.dive()
|
|
109
|
-
.find("TableHeaderCell")
|
|
110
|
-
.at(1)
|
|
111
|
-
.props().sorted
|
|
112
|
-
).toEqual("descending");
|
|
89
|
+
const { getAllByRole } = render(
|
|
90
|
+
<SearchContext.Provider value={searchProps}>
|
|
91
|
+
<StructuresTable {...props} />
|
|
92
|
+
</SearchContext.Provider>,
|
|
93
|
+
renderOpts
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const tableHeaderCells = getAllByRole("columnheader");
|
|
97
|
+
|
|
98
|
+
expect(tableHeaderCells[0]).toHaveClass("descending");
|
|
99
|
+
expect(tableHeaderCells[1]).not.toHaveClass("ascending");
|
|
113
100
|
});
|
|
114
101
|
|
|
115
|
-
it("
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
102
|
+
it("handles sort when column header is clicked", async () => {
|
|
103
|
+
const props = { columns, size };
|
|
104
|
+
|
|
105
|
+
const { getAllByRole } = render(
|
|
106
|
+
<SearchContext.Provider value={searchProps}>
|
|
107
|
+
<StructuresTable {...props} />
|
|
108
|
+
</SearchContext.Provider>,
|
|
109
|
+
renderOpts
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const tableHeaderCells = getAllByRole("columnheader");
|
|
113
|
+
|
|
114
|
+
userEvent.click(await tableHeaderCells[0]);
|
|
115
|
+
await waitFor(() => expect(handleSortSelection).toHaveBeenCalled());
|
|
116
|
+
|
|
117
|
+
userEvent.click(await tableHeaderCells[0]);
|
|
118
|
+
await waitFor(() => expect(handleSortSelection).toHaveBeenCalled());
|
|
130
119
|
});
|
|
131
120
|
});
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
// only admin user
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { render } from "@truedat/test/render";
|
|
4
|
-
import
|
|
4
|
+
import SearchContext from "@truedat/core/search/SearchContext";
|
|
5
|
+
import StructuresUpdateOption from "../StructuresUpdateOption";
|
|
5
6
|
|
|
6
7
|
jest.mock("@truedat/core/hooks", () => ({
|
|
7
8
|
useAuthorized: jest.fn(() => true),
|
|
8
9
|
}));
|
|
9
10
|
|
|
11
|
+
const searchProps = {
|
|
12
|
+
loading: false,
|
|
13
|
+
searchParams: {},
|
|
14
|
+
searchData: {
|
|
15
|
+
_actions: { bulkUpdate: { href: "/structures/bulkUpdate" } },
|
|
16
|
+
data: [{ id: 1, name: "1", type: "API Level" }],
|
|
17
|
+
},
|
|
18
|
+
count: 1,
|
|
19
|
+
allActiveFilters: {
|
|
20
|
+
"type.raw": ["API Level"],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
10
24
|
describe("<StructuresUpdateOption />", () => {
|
|
11
25
|
const renderOpts = {
|
|
12
26
|
messages: {
|
|
@@ -15,19 +29,52 @@ describe("<StructuresUpdateOption />", () => {
|
|
|
15
29
|
"structures.actions.bulk_update.popup": "popup",
|
|
16
30
|
},
|
|
17
31
|
},
|
|
32
|
+
state: {
|
|
33
|
+
systemsLoading: false,
|
|
34
|
+
filtersGroup: [],
|
|
35
|
+
templates: [
|
|
36
|
+
{ scope: "dd", name: "foo" },
|
|
37
|
+
{ scope: "dd", name: "bar" },
|
|
38
|
+
{ name: "baz" },
|
|
39
|
+
],
|
|
40
|
+
structureTypesLoading: false,
|
|
41
|
+
structureTypes: [
|
|
42
|
+
{
|
|
43
|
+
filters: [],
|
|
44
|
+
metadata_fields: ["type"],
|
|
45
|
+
metadata_views: [],
|
|
46
|
+
name: "API Level",
|
|
47
|
+
template: {
|
|
48
|
+
id: 36,
|
|
49
|
+
name: "Calculated Table",
|
|
50
|
+
},
|
|
51
|
+
translation: "API Level 2",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
18
55
|
};
|
|
19
56
|
|
|
20
|
-
it("matches the latest snapshot", () => {
|
|
21
|
-
const { container } = render(
|
|
57
|
+
it("matches the latest snapshot", async () => {
|
|
58
|
+
const { container } = render(
|
|
59
|
+
<SearchContext.Provider value={searchProps}>
|
|
60
|
+
<StructuresUpdateOption />
|
|
61
|
+
</SearchContext.Provider>,
|
|
62
|
+
renderOpts
|
|
63
|
+
);
|
|
22
64
|
expect(container).toMatchSnapshot();
|
|
23
65
|
});
|
|
24
66
|
|
|
25
67
|
it("button will appear disabled if template is empty", () => {
|
|
26
|
-
const
|
|
27
|
-
|
|
68
|
+
const newRenderOps = {
|
|
69
|
+
...renderOpts,
|
|
70
|
+
state: {
|
|
71
|
+
templates: [],
|
|
72
|
+
},
|
|
28
73
|
};
|
|
29
74
|
const { getByRole, queryByText } = render(
|
|
30
|
-
<
|
|
75
|
+
<SearchContext.Provider value={newRenderOps}>
|
|
76
|
+
<StructuresUpdateOption />
|
|
77
|
+
</SearchContext.Provider>,
|
|
31
78
|
renderOpts
|
|
32
79
|
);
|
|
33
80
|
expect(getByRole("option")).toHaveAttribute("aria-disabled");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
|
-
//import { shallow } from "enzyme";
|
|
4
3
|
import { render } from "@truedat/test/render";
|
|
5
4
|
import { within } from "@testing-library/react";
|
|
6
|
-
|
|
7
|
-
import
|
|
5
|
+
import SearchContext from "@truedat/core/search/SearchContext";
|
|
6
|
+
import StructuresView from "../StructuresView";
|
|
7
|
+
import { StructuresViewContent } from "../StructuresView";
|
|
8
8
|
import en from "../../messages/en";
|
|
9
9
|
|
|
10
10
|
const mockHistory = {
|
|
@@ -17,16 +17,76 @@ jest.mock("react-router-dom", () => ({
|
|
|
17
17
|
useParams: () => ({ propertyPath: "metadata.database" }),
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
+
jest.mock("@truedat/dd/hooks/useStructures", () => {
|
|
21
|
+
const originalModule = jest.requireActual("@truedat/dd/hooks/useStructures");
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
__esModule: true,
|
|
25
|
+
...originalModule,
|
|
26
|
+
useDataStructureFilters: () => ({
|
|
27
|
+
trigger: () => ({
|
|
28
|
+
then: (callback) =>
|
|
29
|
+
callback({
|
|
30
|
+
data: { data: {} },
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
}),
|
|
34
|
+
useDataStructureSearch: () => ({
|
|
35
|
+
trigger: () => ({
|
|
36
|
+
then: (callback) =>
|
|
37
|
+
callback({
|
|
38
|
+
data: { data: [] },
|
|
39
|
+
headers: {},
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
20
46
|
const messages = {
|
|
21
47
|
en: {
|
|
22
48
|
...en,
|
|
23
49
|
missingBucket: "_missing",
|
|
50
|
+
"search.placeholder": "Searching ...",
|
|
24
51
|
},
|
|
25
52
|
};
|
|
26
53
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
const renderOpts = {
|
|
55
|
+
messages,
|
|
56
|
+
state: {
|
|
57
|
+
systemsLoading: false,
|
|
58
|
+
filtersGroup: [],
|
|
59
|
+
templates: [
|
|
60
|
+
{ scope: "dd", name: "foo" },
|
|
61
|
+
{ scope: "dd", name: "bar" },
|
|
62
|
+
{ name: "baz" },
|
|
63
|
+
],
|
|
64
|
+
structureTypesLoading: false,
|
|
65
|
+
structureTypes: [
|
|
66
|
+
{
|
|
67
|
+
filters: [],
|
|
68
|
+
metadata_fields: ["type"],
|
|
69
|
+
metadata_views: [],
|
|
70
|
+
name: "API Level",
|
|
71
|
+
template: {
|
|
72
|
+
id: 36,
|
|
73
|
+
name: "Calculated Table",
|
|
74
|
+
},
|
|
75
|
+
translation: "API Level 2",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const searchProps = {
|
|
82
|
+
userFiltersType: "structure",
|
|
83
|
+
loading: false,
|
|
84
|
+
allActiveFilters: {
|
|
85
|
+
template: ["API Level"],
|
|
86
|
+
},
|
|
87
|
+
filtersLoading: false,
|
|
88
|
+
searchData: {
|
|
89
|
+
data: [
|
|
30
90
|
{
|
|
31
91
|
id: 1,
|
|
32
92
|
domain: { name: "org" },
|
|
@@ -36,16 +96,59 @@ describe("<StructuresView />", () => {
|
|
|
36
96
|
system: "sys",
|
|
37
97
|
type: "Table",
|
|
38
98
|
},
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
allFilters: {
|
|
102
|
+
"metadata.database": {
|
|
103
|
+
buckets: [
|
|
104
|
+
{
|
|
105
|
+
doc_count: 11234,
|
|
106
|
+
key: "_missing",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
doc_count: 2345,
|
|
110
|
+
key: "database_1",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
values: ["_missing", "database_1"],
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
44
117
|
|
|
45
|
-
|
|
46
|
-
|
|
118
|
+
describe("<StructuresView />", () => {
|
|
119
|
+
it("shows header if is embedded", () => {
|
|
120
|
+
const props = { embedded: false };
|
|
121
|
+
const { getByRole } = render(
|
|
122
|
+
<SearchContext.Provider value={searchProps}>
|
|
123
|
+
<StructuresView {...props} />
|
|
124
|
+
</SearchContext.Provider>,
|
|
125
|
+
renderOpts
|
|
126
|
+
);
|
|
47
127
|
|
|
48
128
|
expect(getByRole("heading")).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("not shows header if is not embedded", () => {
|
|
132
|
+
const props = { embedded: true };
|
|
133
|
+
const { queryByText } = render(
|
|
134
|
+
<SearchContext.Provider value={searchProps}>
|
|
135
|
+
<StructuresView {...props} />
|
|
136
|
+
</SearchContext.Provider>,
|
|
137
|
+
renderOpts
|
|
138
|
+
);
|
|
139
|
+
expect(queryByText("Data Catalog")).not.toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe("<StructuresViewContent />", () => {
|
|
144
|
+
it("shows structures table if hasFilterAplied", () => {
|
|
145
|
+
const props = {};
|
|
146
|
+
const { getByRole } = render(
|
|
147
|
+
<SearchContext.Provider value={searchProps}>
|
|
148
|
+
<StructuresViewContent {...props} />
|
|
149
|
+
</SearchContext.Provider>,
|
|
150
|
+
renderOpts
|
|
151
|
+
);
|
|
49
152
|
|
|
50
153
|
const table = getByRole("table");
|
|
51
154
|
const rows = within(table).getAllByRole("row");
|
|
@@ -61,26 +164,18 @@ describe("<StructuresView />", () => {
|
|
|
61
164
|
});
|
|
62
165
|
|
|
63
166
|
it("shows CatalogCustomViewCards if customView", () => {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
doc_count: 11234,
|
|
69
|
-
key: "_missing",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
doc_count: 2345,
|
|
73
|
-
key: "database_1",
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
values: ["_missing", "database_1"],
|
|
77
|
-
},
|
|
167
|
+
const newSearchProps = {
|
|
168
|
+
...searchProps,
|
|
169
|
+
toggleDateFilter: false,
|
|
170
|
+
allActiveFilters: {},
|
|
78
171
|
};
|
|
79
172
|
|
|
80
|
-
const { getByRole } = render(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
173
|
+
const { getByRole } = render(
|
|
174
|
+
<SearchContext.Provider value={newSearchProps}>
|
|
175
|
+
<StructuresViewContent customView />
|
|
176
|
+
</SearchContext.Provider>,
|
|
177
|
+
renderOpts
|
|
178
|
+
);
|
|
84
179
|
|
|
85
180
|
const missingCard = getByRole("link", { name: /_missing/ });
|
|
86
181
|
expect(missingCard).toBeInTheDocument();
|