@truedat/bg 7.11.1 → 7.11.3

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": "@truedat/bg",
3
- "version": "7.11.1",
3
+ "version": "7.11.3",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -48,7 +48,7 @@
48
48
  "@testing-library/jest-dom": "^6.6.3",
49
49
  "@testing-library/react": "^16.3.0",
50
50
  "@testing-library/user-event": "^14.6.1",
51
- "@truedat/test": "7.11.1",
51
+ "@truedat/test": "7.11.2",
52
52
  "identity-obj-proxy": "^3.0.0",
53
53
  "jest": "^29.7.0",
54
54
  "redux-saga-test-plan": "^4.0.6"
@@ -81,5 +81,5 @@
81
81
  "semantic-ui-react": "^3.0.0-beta.2",
82
82
  "swr": "^2.3.3"
83
83
  },
84
- "gitHead": "efc0969708811b5e4fc2ea39e628a1b2691e4042"
84
+ "gitHead": "59064d786ac330fd0b9f1d613a7d56f26842caf7"
85
85
  }
@@ -1,14 +1,15 @@
1
1
  import { lazy } from "react";
2
2
  import PropTypes from "prop-types";
3
+ import { SearchContextProvider } from "@truedat/core/search/SearchContext";
4
+ import {
5
+ useRuleImplementationFilters,
6
+ useRuleImplementationSearch,
7
+ } from "@truedat/dq/hooks/useImplementations";
3
8
 
4
9
  const ImplementationFiltersLoader = lazy(
5
10
  () => import("@truedat/dq/components/ImplementationFiltersLoader")
6
11
  );
7
12
 
8
- const ImplementationsLoader = lazy(
9
- () => import("@truedat/dq/components/RuleImplementationsLoader")
10
- );
11
-
12
13
  const ImplementationSearchResults = lazy(
13
14
  () => import("@truedat/dq/components/ImplementationSearchResults")
14
15
  );
@@ -19,11 +20,24 @@ export const DomainImplementations = ({ domain = {} }) => {
19
20
  status: ["published"],
20
21
  };
21
22
 
23
+ const searchProps = {
24
+ initialSortColumn: "implementation_key.raw",
25
+ initialSortDirection: "ascending",
26
+ useSearch: useRuleImplementationSearch,
27
+ useFilters: useRuleImplementationFilters,
28
+ pageSize: 20,
29
+ userFiltersType: "user_search_filters",
30
+ userFilterScope: "rule_implementation",
31
+ defaultFilters,
32
+ };
33
+
34
+
22
35
  return (
23
36
  <>
24
- <ImplementationFiltersLoader defaultFilters={defaultFilters} />
25
- <ImplementationsLoader defaultFilters={defaultFilters} />
26
- <ImplementationSearchResults embedded />
37
+ <SearchContextProvider {...searchProps}>
38
+ <ImplementationFiltersLoader defaultFilters={defaultFilters} />
39
+ <ImplementationSearchResults embedded defaultFilters={defaultFilters} />
40
+ </SearchContextProvider>
27
41
  </>
28
42
  );
29
43
  };
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { render, waitForLoad } from "@truedat/test/render";
3
+ import { useSearchContext } from "@truedat/core/search/SearchContext";
4
+
5
+ import DomainImplementations from "../DomainImplementations";
6
+
7
+ jest.mock("@truedat/core/search/SearchContext", () => {
8
+ const originalModule = jest.requireActual(
9
+ "@truedat/core/search/SearchContext"
10
+ );
11
+
12
+ return {
13
+ __esModule: true,
14
+ ...originalModule,
15
+ useSearchContext: jest.fn(),
16
+ };
17
+ });
18
+
19
+ describe("DomainImplementations", () => {
20
+ beforeEach(() => {
21
+ useSearchContext.mockReturnValue({
22
+ searchData: {
23
+ data: [
24
+ { id: "1", implementation_key: "imp_one" },
25
+ { id: "2", implementation_key: "imp_two" },
26
+ ],
27
+ scroll_id: null,
28
+ },
29
+ searchMust: { status: ["published"] },
30
+ setOnSearchChange: jest.fn(),
31
+ });
32
+ });
33
+
34
+ it("renders DomainImplementations for a given domain", async () => {
35
+ const rendered = render(
36
+ <DomainImplementations domain={{ id: "domain-123" }} />
37
+ );
38
+ await waitForLoad(rendered);
39
+ expect(rendered.container).toMatchSnapshot();
40
+ });
41
+
42
+ it("renders properly when searchData is empty", async () => {
43
+ useSearchContext.mockReturnValue({
44
+ searchData: { data: [], scroll_id: null },
45
+ searchMust: { status: ["published"] },
46
+ setOnSearchChange: jest.fn(),
47
+ });
48
+ const rendered = render(
49
+ <DomainImplementations domain={{ id: "domain-empty" }} />
50
+ );
51
+ await waitForLoad(rendered);
52
+ expect(rendered.container).toMatchSnapshot();
53
+ });
54
+ });
@@ -0,0 +1,304 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`DomainImplementations renders DomainImplementations for a given domain 1`] = `
4
+ <div>
5
+ <div
6
+ border="1px red"
7
+ class="ui bottom attached segment"
8
+ >
9
+ <div
10
+ class="ui action left icon input"
11
+ >
12
+ <i
13
+ aria-hidden="true"
14
+ class="search link icon"
15
+ />
16
+ <input
17
+ placeholder="search.placeholder"
18
+ type="text"
19
+ />
20
+ <div
21
+ aria-expanded="false"
22
+ class="ui button floating labeled scrolling dropdown icon"
23
+ role="listbox"
24
+ tabindex="0"
25
+ >
26
+ <div
27
+ aria-atomic="true"
28
+ aria-live="polite"
29
+ class="divider text"
30
+ role="alert"
31
+ >
32
+ Filters
33
+ </div>
34
+ <i
35
+ aria-hidden="true"
36
+ class="filter icon"
37
+ />
38
+ <div
39
+ class="menu transition"
40
+ >
41
+ <div
42
+ class="item"
43
+ role="option"
44
+ >
45
+ <em>
46
+ (reset filters)
47
+ </em>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ <div
53
+ class="selectedFilters"
54
+ />
55
+ <div
56
+ class="dimmable"
57
+ >
58
+ <div
59
+ class="ui label rules-label-results"
60
+ >
61
+ ruleImplementations.retrieved.results
62
+ </div>
63
+ <div
64
+ class="implementations-table-overflow"
65
+ >
66
+ <table
67
+ class="ui sortable table"
68
+ >
69
+ <thead
70
+ class=""
71
+ >
72
+ <tr
73
+ class=""
74
+ >
75
+ <th
76
+ class="two wide"
77
+ >
78
+ ruleImplementations.props.implementation_key
79
+ </th>
80
+ <th
81
+ class="two wide"
82
+ >
83
+ ruleImplementations.props.rule
84
+ </th>
85
+ <th
86
+ class="two wide ascending sorted disabled"
87
+ >
88
+ ruleImplementations.props.business_concepts
89
+ </th>
90
+ <th
91
+ class="two wide"
92
+ >
93
+ ruleImplementations.props.last_execution_at
94
+ </th>
95
+ <th
96
+ class="two wide"
97
+ >
98
+ ruleImplementations.props.result_type
99
+ </th>
100
+ <th
101
+ class="one wide"
102
+ >
103
+ ruleImplementations.props.minimum
104
+ </th>
105
+ <th
106
+ class="one wide"
107
+ >
108
+ ruleImplementations.props.goal
109
+ </th>
110
+ <th
111
+ class="two wide"
112
+ >
113
+ ruleImplementations.props.result
114
+ </th>
115
+ <th
116
+ class=""
117
+ >
118
+ ruleImplementations.props.inserted_at
119
+ </th>
120
+ <th
121
+ class=""
122
+ >
123
+ ruleImplementations.props.updated_at
124
+ </th>
125
+ </tr>
126
+ </thead>
127
+ <tbody
128
+ class=""
129
+ >
130
+ <tr
131
+ class=""
132
+ >
133
+ <td
134
+ class=""
135
+ >
136
+ <a
137
+ data-discover="true"
138
+ href="/implementations/1"
139
+ >
140
+ imp_one
141
+ </a>
142
+ </td>
143
+ <td
144
+ class=""
145
+ />
146
+ <td
147
+ class=""
148
+ />
149
+ <td
150
+ class=""
151
+ />
152
+ <td
153
+ class=""
154
+ />
155
+ <td
156
+ class="right aligned"
157
+ >
158
+ undefined%
159
+ </td>
160
+ <td
161
+ class="right aligned"
162
+ >
163
+ undefined%
164
+ </td>
165
+ <td
166
+ class="center aligned"
167
+ />
168
+ <td
169
+ class=""
170
+ />
171
+ <td
172
+ class=""
173
+ />
174
+ </tr>
175
+ <tr
176
+ class=""
177
+ >
178
+ <td
179
+ class=""
180
+ >
181
+ <a
182
+ data-discover="true"
183
+ href="/implementations/2"
184
+ >
185
+ imp_two
186
+ </a>
187
+ </td>
188
+ <td
189
+ class=""
190
+ />
191
+ <td
192
+ class=""
193
+ />
194
+ <td
195
+ class=""
196
+ />
197
+ <td
198
+ class=""
199
+ />
200
+ <td
201
+ class="right aligned"
202
+ >
203
+ undefined%
204
+ </td>
205
+ <td
206
+ class="right aligned"
207
+ >
208
+ undefined%
209
+ </td>
210
+ <td
211
+ class="center aligned"
212
+ />
213
+ <td
214
+ class=""
215
+ />
216
+ <td
217
+ class=""
218
+ />
219
+ </tr>
220
+ </tbody>
221
+ </table>
222
+ </div>
223
+ </div>
224
+ </div>
225
+ </div>
226
+ `;
227
+
228
+ exports[`DomainImplementations renders properly when searchData is empty 1`] = `
229
+ <div>
230
+ <div
231
+ border="1px red"
232
+ class="ui bottom attached segment"
233
+ >
234
+ <div
235
+ class="ui action left icon input"
236
+ >
237
+ <i
238
+ aria-hidden="true"
239
+ class="search link icon"
240
+ />
241
+ <input
242
+ placeholder="search.placeholder"
243
+ type="text"
244
+ />
245
+ <div
246
+ aria-expanded="false"
247
+ class="ui button floating labeled scrolling dropdown icon"
248
+ role="listbox"
249
+ tabindex="0"
250
+ >
251
+ <div
252
+ aria-atomic="true"
253
+ aria-live="polite"
254
+ class="divider text"
255
+ role="alert"
256
+ >
257
+ Filters
258
+ </div>
259
+ <i
260
+ aria-hidden="true"
261
+ class="filter icon"
262
+ />
263
+ <div
264
+ class="menu transition"
265
+ >
266
+ <div
267
+ class="item"
268
+ role="option"
269
+ >
270
+ <em>
271
+ (reset filters)
272
+ </em>
273
+ </div>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ <div
278
+ class="selectedFilters"
279
+ />
280
+ <div
281
+ class="dimmable"
282
+ >
283
+ <div
284
+ class="ui label rules-label-results"
285
+ >
286
+ ruleImplementations.retrieved.results
287
+ </div>
288
+ <h4
289
+ class="ui header"
290
+ >
291
+ <i
292
+ aria-hidden="true"
293
+ class="search icon"
294
+ />
295
+ <div
296
+ class="content"
297
+ >
298
+ ruleImplementations.search.results.empty
299
+ </div>
300
+ </h4>
301
+ </div>
302
+ </div>
303
+ </div>
304
+ `;