@truedat/dd 5.15.2 → 5.16.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 +5 -5
- package/src/api.js +6 -0
- package/src/components/GrantRequestApprovalResults.js +40 -0
- package/src/components/GrantRequestBulkActions.js +136 -0
- package/src/components/GrantRequestBulkApprovalForm.js +69 -0
- package/src/components/GrantRequestBulkApprovalPopup.js +43 -0
- package/src/components/GrantRequestBulkRoleSelector.js +41 -0
- package/src/components/GrantRequestRow.js +62 -0
- package/src/components/GrantRequestSearchFilters.js +22 -0
- package/src/components/GrantRequestsFiltersLoader.js +33 -0
- package/src/components/GrantRequestsLabelResults.js +52 -0
- package/src/components/GrantRequestsSearch.js +35 -0
- package/src/components/GrantRequestsSearchLoader.js +47 -0
- package/src/components/GrantRequestsSearchResults.js +156 -0
- package/src/components/GrantRequestsSelectedFilters.js +54 -0
- package/src/components/GrantRequestsTable.js +131 -0
- package/src/components/GrantRoutes.js +34 -16
- package/src/components/Grants.js +1 -0
- package/src/components/__tests__/GrantRequestApprovalResults.spec.js +30 -0
- package/src/components/__tests__/GrantRequestBulkActions.spec.js +31 -0
- package/src/components/__tests__/GrantRequestBulkApprovalForm.spec.js +54 -0
- package/src/components/__tests__/GrantRequestBulkApprovalPopup.spec.js +17 -0
- package/src/components/__tests__/GrantRequestBulkRoleSelector.spec.js +48 -0
- package/src/components/__tests__/GrantRequestFiltersLoader.spec.js +20 -0
- package/src/components/__tests__/GrantRequestRow.spec.js +95 -0
- package/src/components/__tests__/GrantRequestSearchFilters.spec.js +19 -0
- package/src/components/__tests__/GrantRequestsLabelResults.spec.js +45 -0
- package/src/components/__tests__/GrantRequestsSearch.spec.js +23 -0
- package/src/components/__tests__/GrantRequestsSearchLoader.spec.js +15 -0
- package/src/components/__tests__/GrantRequestsSearchResults.spec.js +59 -0
- package/src/components/__tests__/GrantRequestsTable.spec.js +35 -0
- package/src/components/__tests__/__snapshots__/GrantRequestApprovalResults.spec.js.snap +69 -0
- package/src/components/__tests__/__snapshots__/GrantRequestBulkActions.spec.js.snap +51 -0
- package/src/components/__tests__/__snapshots__/GrantRequestBulkApprovalForm.spec.js.snap +41 -0
- package/src/components/__tests__/__snapshots__/GrantRequestBulkApprovalPopup.spec.js.snap +11 -0
- package/src/components/__tests__/__snapshots__/GrantRequestBulkRoleSelector.spec.js.snap +56 -0
- package/src/components/__tests__/__snapshots__/GrantRequestRow.spec.js.snap +55 -0
- package/src/components/__tests__/__snapshots__/GrantRequestSearchFilters.spec.js.snap +47 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsLabelResults.spec.js.snap +36 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsSearch.spec.js.snap +50 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsSearchLoader.spec.js.snap +3 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsSearchResults.spec.js.snap +248 -0
- package/src/components/__tests__/__snapshots__/GrantRequestsTable.spec.js.snap +19 -0
- package/src/components/__tests__/__snapshots__/GrantRoutes.spec.js.snap +0 -4
- package/src/components/index.js +8 -0
- package/src/hooks/useGrantRequest.js +9 -0
- package/src/reducers/__tests__/grantRequestCount.spec.js +38 -0
- package/src/reducers/__tests__/grantRequestPermissions.spec.js +66 -0
- package/src/reducers/__tests__/grantRequestsActiveFilters.spec.js +90 -0
- package/src/reducers/__tests__/grantRequestsFiltersLoading.spec.js +34 -0
- package/src/reducers/__tests__/grantRequestsSearch.spec.js +38 -0
- package/src/reducers/__tests__/grantRequestsSearchLoading.spec.js +36 -0
- package/src/reducers/__tests__/grantRequestsSearchQuery.spec.js +96 -0
- package/src/reducers/__tests__/grantRequestsSelectedFilter.spec.js +72 -0
- package/src/reducers/grantRequestCount.js +23 -0
- package/src/reducers/grantRequestPermissions.js +31 -0
- package/src/reducers/grantRequestSearchQuery.js +55 -0
- package/src/reducers/grantRequestsActiveFilters.js +56 -0
- package/src/reducers/grantRequestsFilters.js +23 -0
- package/src/reducers/grantRequestsFiltersLoading.js +14 -0
- package/src/reducers/grantRequestsSearch.js +19 -0
- package/src/reducers/grantRequestsSearchLoading.js +14 -0
- package/src/reducers/grantRequestsSelectedFilter.js +34 -0
- package/src/reducers/graphLoading.js +2 -0
- package/src/reducers/index.js +22 -0
- package/src/reducers/structureRedirect.js +2 -3
- package/src/routines.js +13 -0
- package/src/sagas/__tests__/createGraph.spec.js +4 -4
- package/src/sagas/__tests__/fetchGrantRequestsFilters.spec.js +91 -0
- package/src/sagas/__tests__/fetchGrantRequestsSearch.spec.js +92 -0
- package/src/sagas/createGraph.js +7 -71
- package/src/sagas/fetchGrantRequestsFilters.js +32 -0
- package/src/sagas/fetchGrantRequestsSearch.js +30 -0
- package/src/sagas/fetchGraph.js +26 -4
- package/src/sagas/graph/polling.js +70 -0
- package/src/sagas/index.js +6 -0
- package/src/selectors/__tests__/getGrantRequestsAvailableFilters.spec.js +15 -0
- package/src/selectors/__tests__/getGrantRequestsFilterTypes.spec.js +19 -0
- package/src/selectors/__tests__/getGrantRequestsSearchColumns.spec.js +30 -0
- package/src/selectors/__tests__/getGrantRequestsSearchQuery.spec.js +24 -0
- package/src/selectors/__tests__/getGrantRequestsSelectedFilterActiveValues.spec.js +15 -0
- package/src/selectors/__tests__/getGrantRequestsSelectedFilterValues.spec.js +15 -0
- package/src/selectors/__tests__/getGrantRequestsSelectedFilters.spec.js +13 -0
- package/src/selectors/getGrantRequestsAvailableFilters.js +17 -0
- package/src/selectors/getGrantRequestsFilterTypes.js +7 -0
- package/src/selectors/getGrantRequestsSearchColumns.js +119 -0
- package/src/selectors/getGrantRequestsSearchQuery.js +19 -0
- package/src/selectors/getGrantRequestsSelectedFilterActiveValues.js +8 -0
- package/src/selectors/getGrantRequestsSelectedFilterValues.js +12 -0
- package/src/selectors/getGrantRequestsSelectedFilters.js +8 -0
- package/src/selectors/index.js +10 -0
- package/src/components/GrantRequestApprovals.js +0 -41
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<GrantRequestsSearch /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui action left icon input"
|
|
7
|
+
>
|
|
8
|
+
<input
|
|
9
|
+
placeholder="placeholder"
|
|
10
|
+
type="text"
|
|
11
|
+
value=""
|
|
12
|
+
/>
|
|
13
|
+
<i
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
class="search link icon"
|
|
16
|
+
/>
|
|
17
|
+
<div
|
|
18
|
+
aria-expanded="false"
|
|
19
|
+
class="ui button floating labeled scrolling dropdown icon"
|
|
20
|
+
role="listbox"
|
|
21
|
+
tabindex="0"
|
|
22
|
+
>
|
|
23
|
+
<div
|
|
24
|
+
aria-atomic="true"
|
|
25
|
+
aria-live="polite"
|
|
26
|
+
class="divider text"
|
|
27
|
+
role="alert"
|
|
28
|
+
>
|
|
29
|
+
Filters
|
|
30
|
+
</div>
|
|
31
|
+
<i
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
class="filter icon"
|
|
34
|
+
/>
|
|
35
|
+
<div
|
|
36
|
+
class="menu transition"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
class="item"
|
|
40
|
+
role="option"
|
|
41
|
+
>
|
|
42
|
+
<em>
|
|
43
|
+
(reset filters)
|
|
44
|
+
</em>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<GrantRequestsSearchResults /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui segment"
|
|
7
|
+
>
|
|
8
|
+
<h2
|
|
9
|
+
class="ui header"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="key circular icon"
|
|
14
|
+
/>
|
|
15
|
+
<div
|
|
16
|
+
class="content"
|
|
17
|
+
>
|
|
18
|
+
header approve
|
|
19
|
+
<div
|
|
20
|
+
class="sub header"
|
|
21
|
+
>
|
|
22
|
+
subheader approve
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</h2>
|
|
26
|
+
<div
|
|
27
|
+
class="ui bottom attached segment"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="grant-requests-bulk-actions"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
class="right aligned four wide column"
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
aria-disabled="false"
|
|
37
|
+
aria-expanded="false"
|
|
38
|
+
class="ui selection dropdown grant-requests-bulk-role-selector"
|
|
39
|
+
role="listbox"
|
|
40
|
+
tabindex="0"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
aria-atomic="true"
|
|
44
|
+
aria-live="polite"
|
|
45
|
+
class="divider default text"
|
|
46
|
+
role="alert"
|
|
47
|
+
>
|
|
48
|
+
select
|
|
49
|
+
</div>
|
|
50
|
+
<i
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
class="dropdown icon"
|
|
53
|
+
/>
|
|
54
|
+
<div
|
|
55
|
+
class="menu transition"
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
aria-checked="false"
|
|
59
|
+
aria-selected="true"
|
|
60
|
+
class="selected item"
|
|
61
|
+
role="option"
|
|
62
|
+
style="pointer-events: all;"
|
|
63
|
+
>
|
|
64
|
+
<span
|
|
65
|
+
class="text"
|
|
66
|
+
>
|
|
67
|
+
bar
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div
|
|
71
|
+
aria-checked="false"
|
|
72
|
+
aria-selected="false"
|
|
73
|
+
class="item"
|
|
74
|
+
role="option"
|
|
75
|
+
style="pointer-events: all;"
|
|
76
|
+
>
|
|
77
|
+
<span
|
|
78
|
+
class="text"
|
|
79
|
+
>
|
|
80
|
+
foo
|
|
81
|
+
</span>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
<button
|
|
86
|
+
class="ui primary disabled button button icon group-actions"
|
|
87
|
+
disabled=""
|
|
88
|
+
tabindex="-1"
|
|
89
|
+
>
|
|
90
|
+
approve
|
|
91
|
+
</button>
|
|
92
|
+
<button
|
|
93
|
+
class="ui secondary disabled button button icon group-actions"
|
|
94
|
+
disabled=""
|
|
95
|
+
tabindex="-1"
|
|
96
|
+
>
|
|
97
|
+
reject
|
|
98
|
+
</button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div
|
|
102
|
+
class="ui action left icon input"
|
|
103
|
+
>
|
|
104
|
+
<input
|
|
105
|
+
placeholder="placeholder"
|
|
106
|
+
type="text"
|
|
107
|
+
value=""
|
|
108
|
+
/>
|
|
109
|
+
<i
|
|
110
|
+
aria-hidden="true"
|
|
111
|
+
class="search link icon"
|
|
112
|
+
/>
|
|
113
|
+
<div
|
|
114
|
+
aria-expanded="false"
|
|
115
|
+
class="ui button floating labeled scrolling dropdown icon"
|
|
116
|
+
role="listbox"
|
|
117
|
+
tabindex="0"
|
|
118
|
+
>
|
|
119
|
+
<div
|
|
120
|
+
aria-atomic="true"
|
|
121
|
+
aria-live="polite"
|
|
122
|
+
class="divider text"
|
|
123
|
+
role="alert"
|
|
124
|
+
>
|
|
125
|
+
Filters
|
|
126
|
+
</div>
|
|
127
|
+
<i
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
class="filter icon"
|
|
130
|
+
/>
|
|
131
|
+
<div
|
|
132
|
+
class="menu transition"
|
|
133
|
+
>
|
|
134
|
+
<div
|
|
135
|
+
class="item"
|
|
136
|
+
role="option"
|
|
137
|
+
>
|
|
138
|
+
<em>
|
|
139
|
+
(reset filters)
|
|
140
|
+
</em>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
<div
|
|
146
|
+
class="selectedFilters"
|
|
147
|
+
/>
|
|
148
|
+
<div
|
|
149
|
+
class="dimmed dimmable"
|
|
150
|
+
>
|
|
151
|
+
<div
|
|
152
|
+
class="ui active transition visible inverted dimmer"
|
|
153
|
+
style="display: flex;"
|
|
154
|
+
>
|
|
155
|
+
<div
|
|
156
|
+
class="content"
|
|
157
|
+
>
|
|
158
|
+
<div
|
|
159
|
+
class="ui loader"
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
<div
|
|
165
|
+
class="ui label grant-requests-bulk-label-results"
|
|
166
|
+
>
|
|
167
|
+
results
|
|
168
|
+
</div>
|
|
169
|
+
<table
|
|
170
|
+
class="ui sortable table"
|
|
171
|
+
>
|
|
172
|
+
<thead
|
|
173
|
+
class=""
|
|
174
|
+
>
|
|
175
|
+
<tr
|
|
176
|
+
class=""
|
|
177
|
+
>
|
|
178
|
+
<th
|
|
179
|
+
class=""
|
|
180
|
+
>
|
|
181
|
+
user
|
|
182
|
+
</th>
|
|
183
|
+
<th
|
|
184
|
+
class=""
|
|
185
|
+
>
|
|
186
|
+
data_structure
|
|
187
|
+
</th>
|
|
188
|
+
<th
|
|
189
|
+
class="ascending sorted disabled"
|
|
190
|
+
>
|
|
191
|
+
path
|
|
192
|
+
</th>
|
|
193
|
+
<th
|
|
194
|
+
class="two wide"
|
|
195
|
+
>
|
|
196
|
+
inserted_at
|
|
197
|
+
</th>
|
|
198
|
+
</tr>
|
|
199
|
+
</thead>
|
|
200
|
+
<tbody
|
|
201
|
+
class=""
|
|
202
|
+
>
|
|
203
|
+
<tr
|
|
204
|
+
class=""
|
|
205
|
+
>
|
|
206
|
+
<td
|
|
207
|
+
class=""
|
|
208
|
+
>
|
|
209
|
+
null
|
|
210
|
+
</td>
|
|
211
|
+
<td
|
|
212
|
+
class=""
|
|
213
|
+
/>
|
|
214
|
+
<td
|
|
215
|
+
class=""
|
|
216
|
+
>
|
|
217
|
+
|
|
218
|
+
</td>
|
|
219
|
+
<td
|
|
220
|
+
class="center aligned"
|
|
221
|
+
/>
|
|
222
|
+
</tr>
|
|
223
|
+
<tr
|
|
224
|
+
class=""
|
|
225
|
+
>
|
|
226
|
+
<td
|
|
227
|
+
class=""
|
|
228
|
+
>
|
|
229
|
+
null
|
|
230
|
+
</td>
|
|
231
|
+
<td
|
|
232
|
+
class=""
|
|
233
|
+
/>
|
|
234
|
+
<td
|
|
235
|
+
class=""
|
|
236
|
+
>
|
|
237
|
+
|
|
238
|
+
</td>
|
|
239
|
+
<td
|
|
240
|
+
class="center aligned"
|
|
241
|
+
/>
|
|
242
|
+
</tr>
|
|
243
|
+
</tbody>
|
|
244
|
+
</table>
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<GrantRequestsTable /> matches the latest snapshot 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<h4
|
|
6
|
+
class="ui header"
|
|
7
|
+
>
|
|
8
|
+
<i
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
class="search icon"
|
|
11
|
+
/>
|
|
12
|
+
<div
|
|
13
|
+
class="content"
|
|
14
|
+
>
|
|
15
|
+
No grant requests found
|
|
16
|
+
</div>
|
|
17
|
+
</h4>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
package/src/components/index.js
CHANGED
|
@@ -2,7 +2,11 @@ import CatalogCustomViewCards from "./CatalogCustomViewCards";
|
|
|
2
2
|
import DictionaryRoutes from "./DictionaryRoutes";
|
|
3
3
|
import FilteredNav from "./FilteredNav";
|
|
4
4
|
import GrantRoutes from "./GrantRoutes";
|
|
5
|
+
import GrantRequestBulkActions from "./GrantRequestBulkActions";
|
|
6
|
+
import GrantRequestsTable from "./GrantRequestsTable";
|
|
7
|
+
import GrantRequestRow from "./GrantRequestRow";
|
|
5
8
|
import GrantSelectedFilters from "./GrantSelectedFilters";
|
|
9
|
+
import GrantRequestsSelectedFilters from "./GrantRequestsSelectedFilters";
|
|
6
10
|
import GrantsTable from "./GrantsTable";
|
|
7
11
|
import LineageDefs from "./LineageDefs";
|
|
8
12
|
import LineageDownloadButton from "./LineageDownloadButton";
|
|
@@ -56,6 +60,10 @@ export {
|
|
|
56
60
|
CatalogCustomViewCards,
|
|
57
61
|
DictionaryRoutes,
|
|
58
62
|
FilteredNav,
|
|
63
|
+
GrantRequestBulkActions,
|
|
64
|
+
GrantRequestsTable,
|
|
65
|
+
GrantRequestRow,
|
|
66
|
+
GrantRequestsSelectedFilters,
|
|
59
67
|
GrantRoutes,
|
|
60
68
|
GrantSelectedFilters,
|
|
61
69
|
GrantsTable,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import useSWRMutations from "swr/mutation";
|
|
2
|
+
import { apiJsonPost } from "@truedat/core/services/api";
|
|
3
|
+
import { API_GRANT_REQUEST_BULK_APPROVAL } from "../api";
|
|
4
|
+
|
|
5
|
+
export const useGrantRequestBulkApproval = () => {
|
|
6
|
+
return useSWRMutations(API_GRANT_REQUEST_BULK_APPROVAL, (url, { arg }) =>
|
|
7
|
+
apiJsonPost(url, arg)
|
|
8
|
+
);
|
|
9
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearGrantRequestsSearch,
|
|
3
|
+
fetchGrantRequestsSearch,
|
|
4
|
+
} from "../../routines";
|
|
5
|
+
import { grantRequestCount } from "..";
|
|
6
|
+
|
|
7
|
+
const fooState = { foo: "bar" };
|
|
8
|
+
|
|
9
|
+
describe("reducers: grantRequestCount", () => {
|
|
10
|
+
const initialState = 0;
|
|
11
|
+
|
|
12
|
+
it("should provide the initial state", () => {
|
|
13
|
+
expect(grantRequestCount(undefined, {})).toEqual(initialState);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should handle the clearGrantRequestsSearch.TRIGGER action", () => {
|
|
17
|
+
expect(
|
|
18
|
+
grantRequestCount(fooState, {
|
|
19
|
+
type: clearGrantRequestsSearch.TRIGGER,
|
|
20
|
+
})
|
|
21
|
+
).toEqual(initialState);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should handle the fetchGrantRequestsSearch.SUCCESS action", () => {
|
|
25
|
+
const count = 123;
|
|
26
|
+
const headers = { "x-total-count": `${count}` };
|
|
27
|
+
expect(
|
|
28
|
+
grantRequestCount(fooState, {
|
|
29
|
+
type: fetchGrantRequestsSearch.SUCCESS,
|
|
30
|
+
payload: { headers },
|
|
31
|
+
})
|
|
32
|
+
).toEqual(count);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should ignore unknown actions", () => {
|
|
36
|
+
expect(grantRequestCount(fooState, { type: "FOO" })).toBe(fooState);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearGrantRequestsSearch,
|
|
3
|
+
fetchGrantRequestsSearch,
|
|
4
|
+
} from "../../routines";
|
|
5
|
+
import { grantRequestPermissions, grantRequestPermissionsLoading } from "..";
|
|
6
|
+
|
|
7
|
+
const fooState = { foo: "bar" };
|
|
8
|
+
|
|
9
|
+
describe("reducers: grantRequestPermissions", () => {
|
|
10
|
+
const initialState = {};
|
|
11
|
+
|
|
12
|
+
it("should provide the initial state", () => {
|
|
13
|
+
expect(grantRequestPermissions(undefined, {})).toEqual(initialState);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should handle the clearGrantRequestsSearch.TRIGGER action", () => {
|
|
17
|
+
expect(
|
|
18
|
+
grantRequestPermissions(fooState, {
|
|
19
|
+
type: clearGrantRequestsSearch.TRIGGER,
|
|
20
|
+
})
|
|
21
|
+
).toEqual(initialState);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should handle the fetchGrantRequestsSearch.SUCCESS action", () => {
|
|
25
|
+
expect(
|
|
26
|
+
grantRequestPermissions(fooState, {
|
|
27
|
+
type: fetchGrantRequestsSearch.SUCCESS,
|
|
28
|
+
payload: { data: { _permissions: ["foo", "bar"] } },
|
|
29
|
+
})
|
|
30
|
+
).toMatchObject(["foo", "bar"]);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should ignore unknown actions", () => {
|
|
34
|
+
expect(grantRequestPermissions(fooState, { type: "FOO" })).toBe(fooState);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe("reducers: grantRequestPermissionsLoading", () => {
|
|
39
|
+
const initialState = {};
|
|
40
|
+
|
|
41
|
+
it("should provide the initial state", () => {
|
|
42
|
+
expect(grantRequestPermissionsLoading(undefined, {})).toEqual(initialState);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should handle the clearGrantRequestsSearch.TRIGGER action", () => {
|
|
46
|
+
expect(
|
|
47
|
+
grantRequestPermissionsLoading(fooState, {
|
|
48
|
+
type: fetchGrantRequestsSearch.TRIGGER,
|
|
49
|
+
})
|
|
50
|
+
).toEqual(true);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("should handle the fetchGrantRequestsSearch.FULFILL action", () => {
|
|
54
|
+
expect(
|
|
55
|
+
grantRequestPermissionsLoading(fooState, {
|
|
56
|
+
type: fetchGrantRequestsSearch.FULFILL,
|
|
57
|
+
})
|
|
58
|
+
).toEqual(false);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("should ignore unknown actions", () => {
|
|
62
|
+
expect(grantRequestPermissionsLoading(fooState, { type: "FOO" })).toBe(
|
|
63
|
+
fooState
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { initialState } from "../grantRequestsActiveFilters";
|
|
2
|
+
import {
|
|
3
|
+
addGrantRequestsFilter,
|
|
4
|
+
clearGrantRequestsFilters,
|
|
5
|
+
closeGrantRequestsFilter,
|
|
6
|
+
removeGrantRequestsFilter,
|
|
7
|
+
resetGrantRequestsFilters,
|
|
8
|
+
toggleGrantRequestsFilterValue,
|
|
9
|
+
} from "../../routines";
|
|
10
|
+
import { grantRequestsActiveFilters } from "..";
|
|
11
|
+
|
|
12
|
+
const fooState = { foo: "bar" };
|
|
13
|
+
|
|
14
|
+
describe("reducers: grantRequestsActiveFilters", () => {
|
|
15
|
+
it("should provide the initial state", () => {
|
|
16
|
+
expect(grantRequestsActiveFilters(undefined, {})).toEqual(initialState);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should handle the clearGrantRequestsFilters.TRIGGER action", () => {
|
|
20
|
+
expect(
|
|
21
|
+
grantRequestsActiveFilters(fooState, {
|
|
22
|
+
type: clearGrantRequestsFilters.TRIGGER,
|
|
23
|
+
})
|
|
24
|
+
).toEqual(initialState);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("should handle the addGrantRequestsFilter.TRIGGER action", () => {
|
|
28
|
+
const filter = "baz";
|
|
29
|
+
const payload = { filter };
|
|
30
|
+
expect(
|
|
31
|
+
grantRequestsActiveFilters(fooState, {
|
|
32
|
+
type: addGrantRequestsFilter.TRIGGER,
|
|
33
|
+
payload,
|
|
34
|
+
})
|
|
35
|
+
).toEqual({ ...fooState, baz: [] });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should handle the closeGrantRequestsFilter.TRIGGER action", () => {
|
|
39
|
+
const foo = ["foo1"];
|
|
40
|
+
const bar = [];
|
|
41
|
+
const state = { foo, bar };
|
|
42
|
+
const payload = { filter: "bar" };
|
|
43
|
+
expect(
|
|
44
|
+
grantRequestsActiveFilters(state, {
|
|
45
|
+
type: closeGrantRequestsFilter.TRIGGER,
|
|
46
|
+
payload,
|
|
47
|
+
})
|
|
48
|
+
).toEqual({ foo });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("should handle the removeGrantRequestsFilter.TRIGGER action", () => {
|
|
52
|
+
const foo = ["foo1"];
|
|
53
|
+
const bar = [];
|
|
54
|
+
const state = { foo, bar };
|
|
55
|
+
const payload = { filter: "foo" };
|
|
56
|
+
expect(
|
|
57
|
+
grantRequestsActiveFilters(state, {
|
|
58
|
+
type: removeGrantRequestsFilter.TRIGGER,
|
|
59
|
+
payload,
|
|
60
|
+
})
|
|
61
|
+
).toEqual({ bar });
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("should handle the resetGrantRequestsFilters.TRIGGER action", () => {
|
|
65
|
+
expect(
|
|
66
|
+
grantRequestsActiveFilters(fooState, {
|
|
67
|
+
type: resetGrantRequestsFilters.TRIGGER,
|
|
68
|
+
})
|
|
69
|
+
).toEqual(initialState);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("should handle the toggleGrantRequestsFilterValue.TRIGGER action", () => {
|
|
73
|
+
const foo = ["foo1", "foo2", "foo3"];
|
|
74
|
+
const bar = [];
|
|
75
|
+
const state = { foo, bar };
|
|
76
|
+
const payload = { filter: "foo", value: "foo2" };
|
|
77
|
+
expect(
|
|
78
|
+
grantRequestsActiveFilters(state, {
|
|
79
|
+
type: toggleGrantRequestsFilterValue.TRIGGER,
|
|
80
|
+
payload,
|
|
81
|
+
})
|
|
82
|
+
).toEqual({ foo: ["foo1", "foo3"], bar });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("should ignore unknown actions", () => {
|
|
86
|
+
expect(grantRequestsActiveFilters(fooState, { type: "FOO" })).toBe(
|
|
87
|
+
fooState
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { fetchGrantRequestsFilters } from "../../routines";
|
|
2
|
+
import { grantRequestsFiltersLoading } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: grantRequestsFiltersLoading", () => {
|
|
7
|
+
const initialState = false;
|
|
8
|
+
|
|
9
|
+
it("should provide the initial state", () => {
|
|
10
|
+
expect(grantRequestsFiltersLoading(undefined, {})).toEqual(initialState);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle the fetchGrantRequestsFilters.REQUEST action", () => {
|
|
14
|
+
expect(
|
|
15
|
+
grantRequestsFiltersLoading(fooState, {
|
|
16
|
+
type: fetchGrantRequestsFilters.REQUEST,
|
|
17
|
+
})
|
|
18
|
+
).toEqual(true);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should handle the fetchGrantRequestsFilters.FULFILL action", () => {
|
|
22
|
+
expect(
|
|
23
|
+
grantRequestsFiltersLoading(fooState, {
|
|
24
|
+
type: fetchGrantRequestsFilters.FULFILL,
|
|
25
|
+
})
|
|
26
|
+
).toEqual(false);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should ignore unknown actions", () => {
|
|
30
|
+
expect(grantRequestsFiltersLoading(fooState, { type: "FOO" })).toBe(
|
|
31
|
+
fooState
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
clearGrantRequestsSearch,
|
|
3
|
+
fetchGrantRequestsSearch,
|
|
4
|
+
} from "../../routines";
|
|
5
|
+
import { grantRequestsSearch } from "..";
|
|
6
|
+
|
|
7
|
+
const fooState = { foo: "bar" };
|
|
8
|
+
|
|
9
|
+
describe("reducers: grantRequestsSearch", () => {
|
|
10
|
+
const initialState = [];
|
|
11
|
+
|
|
12
|
+
it("should provide the initial state", () => {
|
|
13
|
+
expect(grantRequestsSearch(undefined, {})).toEqual(initialState);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should handle the clearGrantRequestsSearch.TRIGGER action", () => {
|
|
17
|
+
expect(
|
|
18
|
+
grantRequestsSearch(fooState, { type: clearGrantRequestsSearch.TRIGGER })
|
|
19
|
+
).toEqual(initialState);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should handle the SUCCESS action", () => {
|
|
23
|
+
const grantRequests = [{ id: 1 }, { id: 2 }];
|
|
24
|
+
|
|
25
|
+
const data = { data: grantRequests };
|
|
26
|
+
|
|
27
|
+
expect(
|
|
28
|
+
grantRequestsSearch(fooState, {
|
|
29
|
+
type: fetchGrantRequestsSearch.SUCCESS,
|
|
30
|
+
payload: { data },
|
|
31
|
+
})
|
|
32
|
+
).toMatchObject(grantRequests);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should ignore unknown actions", () => {
|
|
36
|
+
expect(grantRequestsSearch(fooState, { type: "FOO" })).toBe(fooState);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fetchGrantRequestsSearch } from "../../routines";
|
|
2
|
+
import { grantRequestsSearchLoading } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: grantRequestsSearchLoading", () => {
|
|
7
|
+
const initialState = false;
|
|
8
|
+
|
|
9
|
+
it("should provide the initialState", () => {
|
|
10
|
+
expect(grantRequestsSearchLoading(undefined, {})).toEqual(initialState);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle the fetchGrantRequestsSearch.REQUEST action", () => {
|
|
14
|
+
expect(
|
|
15
|
+
grantRequestsSearchLoading(fooState, {
|
|
16
|
+
type: fetchGrantRequestsSearch.REQUEST,
|
|
17
|
+
})
|
|
18
|
+
).toEqual(fooState);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should handle the fetchGrantRequestsSearch.SUCCESS action", () => {
|
|
22
|
+
expect(
|
|
23
|
+
grantRequestsSearchLoading(fooState, {
|
|
24
|
+
type: fetchGrantRequestsSearch.SUCCESS,
|
|
25
|
+
})
|
|
26
|
+
).toEqual(fooState);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should handle the fetchGrantRequestsSearch.FAILURE action", () => {
|
|
30
|
+
expect(
|
|
31
|
+
grantRequestsSearchLoading(fooState, {
|
|
32
|
+
type: fetchGrantRequestsSearch.FAILURE,
|
|
33
|
+
})
|
|
34
|
+
).toEqual(fooState);
|
|
35
|
+
});
|
|
36
|
+
});
|