@truedat/audit 8.7.0 → 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 +3 -3
- package/src/components/ContentFilters.js +6 -6
- package/src/components/ShareLinkForm.js +3 -3
- package/src/components/Subscription.js +3 -3
- package/src/components/SubscriptionActions.js +1 -1
- package/src/components/SubscriptionEdit.js +2 -2
- package/src/components/SubscriptionForm.js +8 -8
- package/src/components/SubscriptionNew.js +1 -1
- package/src/components/SubscriptionRoutes.js +3 -3
- package/src/components/Subscriptions.js +5 -5
- package/src/components/__tests__/NotificationEvent.spec.js +2 -2
- package/src/components/__tests__/NotificationsMenu.spec.js +2 -2
- package/src/components/__tests__/ShareLinkForm.spec.js +3 -3
- package/src/components/__tests__/SubscriptionForm.spec.js +26 -18
- package/src/components/__tests__/SubscriptionFormSelectors.spec.js +14 -14
- package/src/components/__tests__/SubscriptionWatchForm.spec.js +1 -1
- package/src/hooks/useEvents.js +1 -1
- package/src/messages/index.js +1 -1
- package/src/reducers/__tests__/auditMessage.spec.js +1 -1
- package/src/reducers/__tests__/auditRedirect.spec.js +6 -6
- package/src/reducers/__tests__/creatingSubscription.spec.js +2 -2
- package/src/reducers/__tests__/events.spec.js +1 -1
- package/src/reducers/__tests__/notificationSaving.spec.js +2 -2
- package/src/reducers/__tests__/notifications.spec.js +7 -7
- package/src/reducers/__tests__/notificationsLoading.spec.js +2 -2
- package/src/reducers/__tests__/searchSubscription.spec.js +3 -3
- package/src/reducers/__tests__/subscription.spec.js +3 -3
- package/src/reducers/__tests__/subscriptionLoading.spec.js +2 -2
- package/src/reducers/__tests__/subscriptionUpdating.spec.js +6 -6
- package/src/reducers/__tests__/subscriptions.spec.js +3 -3
- package/src/reducers/__tests__/subscriptionsLoading.spec.js +2 -2
- package/src/sagas/__tests__/createNotification.spec.js +2 -2
- package/src/sagas/__tests__/createSubscription.spec.js +9 -9
- package/src/sagas/__tests__/deleteSubscription.spec.js +1 -1
- package/src/sagas/__tests__/fetchEvents.spec.js +1 -1
- package/src/sagas/__tests__/fetchNotifications.spec.js +2 -2
- package/src/sagas/__tests__/fetchSubscription.spec.js +1 -1
- package/src/sagas/__tests__/fetchSubscriptions.spec.js +2 -2
- package/src/sagas/__tests__/searchSubscriptions.spec.js +5 -5
- package/src/sagas/__tests__/updateSubscription.spec.js +1 -1
- package/src/sagas/createSubscription.js +5 -2
- package/src/sagas/deleteSubscription.js +1 -1
- package/src/sagas/updateSubscription.js +1 -1
- package/src/subscriptionConstants.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/audit",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Truedat Web Audit Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
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.7.
|
|
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"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
84
84
|
"swr": "^2.3.3"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "f7605a6ea3f78839b42bb7d8339eec125ba49acb"
|
|
87
87
|
}
|
|
@@ -13,7 +13,7 @@ const toTemplateOptions = (formatMessage) =>
|
|
|
13
13
|
value,
|
|
14
14
|
text: formatMessage({ id: `templates.${label}`, defaultMessage: label }),
|
|
15
15
|
})),
|
|
16
|
-
_.sortBy("text")
|
|
16
|
+
_.sortBy("text"),
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const isFixed = _.conformsTo({ fixed: _.negate(_.isEmpty) });
|
|
@@ -31,7 +31,7 @@ const fieldsFromTemplate = _.flow(
|
|
|
31
31
|
_.prop("content"),
|
|
32
32
|
_.flatMap("fields"),
|
|
33
33
|
_.filter("subscribable"),
|
|
34
|
-
_.defaultTo([])
|
|
34
|
+
_.defaultTo([]),
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const renderFixed = (formatMessage, fieldName) =>
|
|
@@ -45,7 +45,7 @@ const renderFixed = (formatMessage, fieldName) =>
|
|
|
45
45
|
})
|
|
46
46
|
: value,
|
|
47
47
|
value,
|
|
48
|
-
}))
|
|
48
|
+
})),
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
const renderFixedTuple = (formatMessage, fieldName) =>
|
|
@@ -59,7 +59,7 @@ const renderFixedTuple = (formatMessage, fieldName) =>
|
|
|
59
59
|
})
|
|
60
60
|
: text,
|
|
61
61
|
value,
|
|
62
|
-
}))
|
|
62
|
+
})),
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const toValueOptions = (formatMessage, fieldName) =>
|
|
@@ -90,7 +90,7 @@ export const ContentFilters = ({
|
|
|
90
90
|
if (conceptType) {
|
|
91
91
|
setValue(
|
|
92
92
|
"scope.filters.template.id",
|
|
93
|
-
_.flow(_.find({ name: conceptType }), _.prop("id"))(templates)
|
|
93
|
+
_.flow(_.find({ name: conceptType }), _.prop("id"))(templates),
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
}, [conceptType, setValue, templates]);
|
|
@@ -108,7 +108,7 @@ export const ContentFilters = ({
|
|
|
108
108
|
|
|
109
109
|
const fields = _.flow(
|
|
110
110
|
_.find({ id: templateId }),
|
|
111
|
-
fieldsFromTemplate
|
|
111
|
+
fieldsFromTemplate,
|
|
112
112
|
)(templates);
|
|
113
113
|
const field = _.find({ name: filterName })(fields);
|
|
114
114
|
|
|
@@ -9,11 +9,11 @@ import { getRecipients } from "@truedat/core/selectors";
|
|
|
9
9
|
import { createNotification } from "../routines";
|
|
10
10
|
|
|
11
11
|
const UsersSearchLoader = lazy(
|
|
12
|
-
() => import("@truedat/auth/users/components/UsersSearchLoader")
|
|
12
|
+
() => import("@truedat/auth/users/components/UsersSearchLoader"),
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
const GroupsSearchLoader = lazy(
|
|
16
|
-
() => import("@truedat/auth/groups/components/GroupsSearchLoader")
|
|
16
|
+
() => import("@truedat/auth/groups/components/GroupsSearchLoader"),
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const MIN_SEARCH_CHARACTERS = 2;
|
|
@@ -38,7 +38,7 @@ export const ShareLinkForm = ({
|
|
|
38
38
|
name === "shareDropdown" &&
|
|
39
39
|
_.flow(
|
|
40
40
|
_.filter((o) => value.includes(_.prop("value")(o))),
|
|
41
|
-
setSelected
|
|
41
|
+
setSelected,
|
|
42
42
|
)(dropdownOptions);
|
|
43
43
|
name === "shareTextarea" && setMessage(value);
|
|
44
44
|
};
|
|
@@ -19,7 +19,7 @@ const fromTuple = (field, selectedValue) =>
|
|
|
19
19
|
_.flow(
|
|
20
20
|
_.pathOr([], "values.fixed_tuple"),
|
|
21
21
|
_.find(({ value }) => value === selectedValue),
|
|
22
|
-
_.prop("text")
|
|
22
|
+
_.prop("text"),
|
|
23
23
|
)(field);
|
|
24
24
|
|
|
25
25
|
const fieldValue = (value, field) => {
|
|
@@ -71,7 +71,7 @@ export const Subscription = ({
|
|
|
71
71
|
type === "user"
|
|
72
72
|
? _.flow(
|
|
73
73
|
_.find({ id: parseInt(identifier, 10) }),
|
|
74
|
-
_.prop("full_name")
|
|
74
|
+
_.prop("full_name"),
|
|
75
75
|
)(users)
|
|
76
76
|
: identifier;
|
|
77
77
|
const resourceName = subscription.resource?.name;
|
|
@@ -85,7 +85,7 @@ export const Subscription = ({
|
|
|
85
85
|
_.prop("content"),
|
|
86
86
|
_.defaultTo([]),
|
|
87
87
|
_.flatMap("fields"),
|
|
88
|
-
_.find({ name: filters?.content?.name })
|
|
88
|
+
_.find({ name: filters?.content?.name }),
|
|
89
89
|
)(template);
|
|
90
90
|
const fieldLabel = field?.label;
|
|
91
91
|
|
|
@@ -31,7 +31,7 @@ export const SubscriptionEdit = ({
|
|
|
31
31
|
type === "user"
|
|
32
32
|
? _.flow(
|
|
33
33
|
_.find({ id: parseInt(identifier, 10) }),
|
|
34
|
-
_.get("full_name")
|
|
34
|
+
_.get("full_name"),
|
|
35
35
|
)(users)
|
|
36
36
|
: identifier;
|
|
37
37
|
const resourceName = _.get("resource.name")(subscription);
|
|
@@ -68,5 +68,5 @@ export const mapStateToProps = ({
|
|
|
68
68
|
}) => ({ subscription, subscriptionLoading, users });
|
|
69
69
|
|
|
70
70
|
export default connect(mapStateToProps, { updateSubscription })(
|
|
71
|
-
SubscriptionEdit
|
|
71
|
+
SubscriptionEdit,
|
|
72
72
|
);
|
|
@@ -22,27 +22,27 @@ import {
|
|
|
22
22
|
import ContentFilters from "./ContentFilters";
|
|
23
23
|
|
|
24
24
|
const ConceptSelector = lazy(
|
|
25
|
-
() => import("@truedat/bg/concepts/relations/components/ConceptSelector")
|
|
25
|
+
() => import("@truedat/bg/concepts/relations/components/ConceptSelector"),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
const UserSelector = lazy(
|
|
29
|
-
() => import("@truedat/auth/users/components/UserSelector")
|
|
29
|
+
() => import("@truedat/auth/users/components/UserSelector"),
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
const RoleSelector = lazy(
|
|
33
|
-
() => import("@truedat/auth/roles/components/RoleSelector")
|
|
33
|
+
() => import("@truedat/auth/roles/components/RoleSelector"),
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
const StructureSelector = lazy(
|
|
37
|
-
() => import("@truedat/dd/components/StructureSelector")
|
|
37
|
+
() => import("@truedat/dd/components/StructureSelector"),
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
const SourceSelector = lazy(
|
|
41
|
-
() => import("@truedat/cx/sources/components/SourceSelector")
|
|
41
|
+
() => import("@truedat/cx/sources/components/SourceSelector"),
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
const QualityControlSelector = lazy(
|
|
45
|
-
() => import("@truedat/qx/components/qualityControls/QualityControlSelector")
|
|
45
|
+
() => import("@truedat/qx/components/qualityControls/QualityControlSelector"),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const SUBSCRIBER_TYPES = ["role", "taxonomy_role", "email", "user"];
|
|
@@ -157,7 +157,7 @@ export const SubscriptionForm = ({
|
|
|
157
157
|
? events
|
|
158
158
|
: !_.isEmpty(events)
|
|
159
159
|
? _.difference(eventsbytype)(exclusiveEvents)
|
|
160
|
-
: eventsbytype
|
|
160
|
+
: eventsbytype,
|
|
161
161
|
);
|
|
162
162
|
}, [resourceType, events]);
|
|
163
163
|
|
|
@@ -168,7 +168,7 @@ export const SubscriptionForm = ({
|
|
|
168
168
|
const statuses = _.flow(
|
|
169
169
|
_.pick(events),
|
|
170
170
|
_.values,
|
|
171
|
-
_.flatten
|
|
171
|
+
_.flatten,
|
|
172
172
|
)(STATUSES_BY_EVENT);
|
|
173
173
|
|
|
174
174
|
const isFormFilled =
|
|
@@ -14,15 +14,15 @@ import SubscriptionLoader from "./SubscriptionLoader";
|
|
|
14
14
|
import SubscriptionsLoader from "./SubscriptionsLoader";
|
|
15
15
|
|
|
16
16
|
const UsersLoader = React.lazy(
|
|
17
|
-
() => import("@truedat/auth/users/components/UsersLoader")
|
|
17
|
+
() => import("@truedat/auth/users/components/UsersLoader"),
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
const RolesLoader = React.lazy(
|
|
21
|
-
() => import("@truedat/auth/roles/components/RolesLoader")
|
|
21
|
+
() => import("@truedat/auth/roles/components/RolesLoader"),
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const TemplatesLoader = React.lazy(
|
|
25
|
-
() => import("@truedat/core/components/TemplatesLoader")
|
|
25
|
+
() => import("@truedat/core/components/TemplatesLoader"),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
export const SubscriptionRoutes = () => (
|
|
@@ -83,9 +83,9 @@ export const Subscriptions = ({
|
|
|
83
83
|
const orderedSubscriptions = _.flow(
|
|
84
84
|
_.filter(({ subscriber: { type } }) => _.includes(type)(subscriberTypes)),
|
|
85
85
|
_.filter(({ scope: { resource_type } }) =>
|
|
86
|
-
_.includes(resource_type)(resourceTypes)
|
|
86
|
+
_.includes(resource_type)(resourceTypes),
|
|
87
87
|
),
|
|
88
|
-
_.orderBy(["id"], ["desc"])
|
|
88
|
+
_.orderBy(["id"], ["desc"]),
|
|
89
89
|
)(subscriptions);
|
|
90
90
|
|
|
91
91
|
return (
|
|
@@ -121,7 +121,7 @@ export const Subscriptions = ({
|
|
|
121
121
|
onChange(
|
|
122
122
|
_.includes(type)(value)
|
|
123
123
|
? _.filter((t) => t !== type)(value)
|
|
124
|
-
: [...value, type]
|
|
124
|
+
: [...value, type],
|
|
125
125
|
);
|
|
126
126
|
}}
|
|
127
127
|
checked={_.includes(type)(value)}
|
|
@@ -155,7 +155,7 @@ export const Subscriptions = ({
|
|
|
155
155
|
onChange(
|
|
156
156
|
_.includes(type)(value)
|
|
157
157
|
? _.filter((t) => t !== type)(value)
|
|
158
|
-
: [...value, type]
|
|
158
|
+
: [...value, type],
|
|
159
159
|
);
|
|
160
160
|
}}
|
|
161
161
|
checked={_.includes(type)(value)}
|
|
@@ -209,7 +209,7 @@ export const Subscriptions = ({
|
|
|
209
209
|
) : null}
|
|
210
210
|
</Table.Cell>
|
|
211
211
|
</Table.Row>
|
|
212
|
-
)
|
|
212
|
+
),
|
|
213
213
|
)}
|
|
214
214
|
</Table.Body>
|
|
215
215
|
</Table>
|
|
@@ -12,7 +12,7 @@ describe("<NotificationEvent />", () => {
|
|
|
12
12
|
const date = new Date("2020-01-01");
|
|
13
13
|
|
|
14
14
|
const { container } = render(
|
|
15
|
-
<NotificationEvent event={event} date={date}
|
|
15
|
+
<NotificationEvent event={event} date={date} />,
|
|
16
16
|
);
|
|
17
17
|
expect(container).toMatchSnapshot();
|
|
18
18
|
});
|
|
@@ -29,7 +29,7 @@ describe("<NotificationEvent />", () => {
|
|
|
29
29
|
const date = new Date("2020-01-01");
|
|
30
30
|
|
|
31
31
|
const { container } = render(
|
|
32
|
-
<NotificationEvent event={event} date={date}
|
|
32
|
+
<NotificationEvent event={event} date={date} />,
|
|
33
33
|
);
|
|
34
34
|
expect(container).toMatchSnapshot();
|
|
35
35
|
});
|
|
@@ -31,7 +31,7 @@ describe("<NotificationsMenu />", () => {
|
|
|
31
31
|
fetchNotifications={fetchNotifications}
|
|
32
32
|
notifications={notifications}
|
|
33
33
|
notificationsLoading={notificationsLoading}
|
|
34
|
-
|
|
34
|
+
/>,
|
|
35
35
|
);
|
|
36
36
|
expect(container).toMatchSnapshot();
|
|
37
37
|
});
|
|
@@ -60,7 +60,7 @@ describe("<NotificationsMenu />", () => {
|
|
|
60
60
|
fetchNotifications={fetchNotifications}
|
|
61
61
|
notifications={notifications}
|
|
62
62
|
notificationsLoading={notificationsLoading}
|
|
63
|
-
|
|
63
|
+
/>,
|
|
64
64
|
);
|
|
65
65
|
expect(container).toMatchSnapshot();
|
|
66
66
|
});
|
|
@@ -47,7 +47,7 @@ describe("<ShareLinkForm />", () => {
|
|
|
47
47
|
await user.click(await rendered.findByText(/john/i));
|
|
48
48
|
await waitFor(() => {
|
|
49
49
|
expect(
|
|
50
|
-
rendered.queryByRole("button", { name: /share/i })
|
|
50
|
+
rendered.queryByRole("button", { name: /share/i }),
|
|
51
51
|
).not.toBeDisabled();
|
|
52
52
|
});
|
|
53
53
|
});
|
|
@@ -61,7 +61,7 @@ describe("<ShareLinkForm />", () => {
|
|
|
61
61
|
await user.click(await rendered.findByText(/john/i));
|
|
62
62
|
await waitFor(() => {
|
|
63
63
|
expect(
|
|
64
|
-
rendered.queryByRole("button", { name: /share/i })
|
|
64
|
+
rendered.queryByRole("button", { name: /share/i }),
|
|
65
65
|
).not.toBeDisabled();
|
|
66
66
|
});
|
|
67
67
|
await user.click(await rendered.findByRole("button", { name: /share/i }));
|
|
@@ -73,7 +73,7 @@ describe("<ShareLinkForm />", () => {
|
|
|
73
73
|
recipients: [{ id: 1, role: "user" }],
|
|
74
74
|
resource: { description: "desc", name: "foo" },
|
|
75
75
|
uri: "http://localhost/url",
|
|
76
|
-
})
|
|
76
|
+
}),
|
|
77
77
|
);
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -69,21 +69,23 @@ describe("<SubscriptionForm />", () => {
|
|
|
69
69
|
<SearchContextWrapper props={searchProps}>
|
|
70
70
|
<SubscriptionForm {...props} />
|
|
71
71
|
</SearchContextWrapper>,
|
|
72
|
-
renderOpts
|
|
72
|
+
renderOpts,
|
|
73
73
|
);
|
|
74
74
|
await waitForLoad(rendered);
|
|
75
75
|
|
|
76
76
|
const user = userEvent.setup({ delay: null });
|
|
77
77
|
|
|
78
78
|
expect(
|
|
79
|
-
rendered.getByRole("button", { name: "actions.save" })
|
|
79
|
+
rendered.getByRole("button", { name: "actions.save" }),
|
|
80
80
|
).toBeDisabled();
|
|
81
81
|
|
|
82
82
|
// Select role
|
|
83
83
|
await user.click(rendered.getByText("role"));
|
|
84
84
|
|
|
85
85
|
await waitFor(() =>
|
|
86
|
-
expect(
|
|
86
|
+
expect(
|
|
87
|
+
rendered.getByText(/role.search.placeholder/i),
|
|
88
|
+
).toBeInTheDocument(),
|
|
87
89
|
);
|
|
88
90
|
|
|
89
91
|
await user.click(await rendered.findByText(/role2/i));
|
|
@@ -92,7 +94,7 @@ describe("<SubscriptionForm />", () => {
|
|
|
92
94
|
await user.click(rendered.getByText(/email/i));
|
|
93
95
|
|
|
94
96
|
await waitFor(() =>
|
|
95
|
-
expect(rendered.getByTestId("email-input")).toBeInTheDocument()
|
|
97
|
+
expect(rendered.getByTestId("email-input")).toBeInTheDocument(),
|
|
96
98
|
);
|
|
97
99
|
|
|
98
100
|
await user.type(rendered.getByTestId("email-input"), "foo");
|
|
@@ -102,14 +104,16 @@ describe("<SubscriptionForm />", () => {
|
|
|
102
104
|
|
|
103
105
|
await waitFor(() =>
|
|
104
106
|
expect(
|
|
105
|
-
rendered.getByText(/concepts.search.results.empty/i)
|
|
106
|
-
).toBeInTheDocument()
|
|
107
|
+
rendered.getByText(/concepts.search.results.empty/i),
|
|
108
|
+
).toBeInTheDocument(),
|
|
107
109
|
);
|
|
108
110
|
|
|
109
111
|
await user.click(rendered.getByText("taxonomy_role"));
|
|
110
112
|
|
|
111
113
|
await waitFor(() =>
|
|
112
|
-
expect(
|
|
114
|
+
expect(
|
|
115
|
+
rendered.getByText(/role.search.placeholder/i),
|
|
116
|
+
).toBeInTheDocument(),
|
|
113
117
|
);
|
|
114
118
|
|
|
115
119
|
// Wait for concepts.search.results.empty to disappear
|
|
@@ -122,7 +126,9 @@ describe("<SubscriptionForm />", () => {
|
|
|
122
126
|
await user.click(rendered.getByText(/user/i));
|
|
123
127
|
|
|
124
128
|
await waitFor(() =>
|
|
125
|
-
expect(
|
|
129
|
+
expect(
|
|
130
|
+
rendered.getByText(/user.search.placeholder/i),
|
|
131
|
+
).toBeInTheDocument(),
|
|
126
132
|
);
|
|
127
133
|
|
|
128
134
|
await user.click(await rendered.findByText(/user2/i));
|
|
@@ -132,8 +138,8 @@ describe("<SubscriptionForm />", () => {
|
|
|
132
138
|
|
|
133
139
|
await waitFor(() =>
|
|
134
140
|
expect(
|
|
135
|
-
rendered.getByText(/concepts.search.results.empty/i)
|
|
136
|
-
).toBeInTheDocument()
|
|
141
|
+
rendered.getByText(/concepts.search.results.empty/i),
|
|
142
|
+
).toBeInTheDocument(),
|
|
137
143
|
);
|
|
138
144
|
|
|
139
145
|
// Test structures
|
|
@@ -142,8 +148,8 @@ describe("<SubscriptionForm />", () => {
|
|
|
142
148
|
// Wait for loading to disappear
|
|
143
149
|
await waitFor(() =>
|
|
144
150
|
expect(
|
|
145
|
-
rendered.getByText(/structures.not_found.body/i)
|
|
146
|
-
).toBeInTheDocument()
|
|
151
|
+
rendered.getByText(/structures.not_found.body/i),
|
|
152
|
+
).toBeInTheDocument(),
|
|
147
153
|
);
|
|
148
154
|
|
|
149
155
|
expect(rendered.container.querySelector(".loading")).toBeNull();
|
|
@@ -153,8 +159,8 @@ describe("<SubscriptionForm />", () => {
|
|
|
153
159
|
|
|
154
160
|
await waitFor(() =>
|
|
155
161
|
expect(
|
|
156
|
-
rendered.getByText(/domain.selector.placeholder/i)
|
|
157
|
-
).toBeInTheDocument()
|
|
162
|
+
rendered.getByText(/domain.selector.placeholder/i),
|
|
163
|
+
).toBeInTheDocument(),
|
|
158
164
|
);
|
|
159
165
|
|
|
160
166
|
await user.click(await rendered.findByText(/foodomain/i));
|
|
@@ -199,14 +205,16 @@ describe("<SubscriptionForm />", () => {
|
|
|
199
205
|
const user = userEvent.setup({ delay: null });
|
|
200
206
|
|
|
201
207
|
expect(
|
|
202
|
-
rendered.getByRole("button", { name: "actions.save" })
|
|
208
|
+
rendered.getByRole("button", { name: "actions.save" }),
|
|
203
209
|
).toBeDisabled();
|
|
204
210
|
|
|
205
211
|
// Select user
|
|
206
212
|
await user.click(rendered.getByText(/user/i));
|
|
207
213
|
|
|
208
214
|
await waitFor(() =>
|
|
209
|
-
expect(
|
|
215
|
+
expect(
|
|
216
|
+
rendered.getByText(/user.search.placeholder/i),
|
|
217
|
+
).toBeInTheDocument(),
|
|
210
218
|
);
|
|
211
219
|
|
|
212
220
|
await user.click(await rendered.findByText(/user2/i));
|
|
@@ -216,8 +224,8 @@ describe("<SubscriptionForm />", () => {
|
|
|
216
224
|
|
|
217
225
|
await waitFor(() =>
|
|
218
226
|
expect(
|
|
219
|
-
rendered.getByText(/domain.selector.placeholder/i)
|
|
220
|
-
).toBeInTheDocument()
|
|
227
|
+
rendered.getByText(/domain.selector.placeholder/i),
|
|
228
|
+
).toBeInTheDocument(),
|
|
221
229
|
);
|
|
222
230
|
|
|
223
231
|
await user.click(await rendered.findByText(/foodomain/i));
|
|
@@ -68,7 +68,7 @@ jest.mock(
|
|
|
68
68
|
MockQCSelector
|
|
69
69
|
</button>
|
|
70
70
|
),
|
|
71
|
-
})
|
|
71
|
+
}),
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
jest.mock("@truedat/auth/users/components/UserSelector", () => ({
|
|
@@ -105,7 +105,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
105
105
|
|
|
106
106
|
const rendered = render(
|
|
107
107
|
<SubscriptionForm onSubmit={onSubmit} />,
|
|
108
|
-
renderOpts
|
|
108
|
+
renderOpts,
|
|
109
109
|
);
|
|
110
110
|
await waitForLoad(rendered);
|
|
111
111
|
|
|
@@ -132,7 +132,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
132
132
|
resource_id: "42",
|
|
133
133
|
}),
|
|
134
134
|
periodicity: "daily",
|
|
135
|
-
})
|
|
135
|
+
}),
|
|
136
136
|
);
|
|
137
137
|
});
|
|
138
138
|
});
|
|
@@ -143,7 +143,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
143
143
|
|
|
144
144
|
const rendered = render(
|
|
145
145
|
<SubscriptionForm onSubmit={onSubmit} />,
|
|
146
|
-
renderOpts
|
|
146
|
+
renderOpts,
|
|
147
147
|
);
|
|
148
148
|
await waitForLoad(rendered);
|
|
149
149
|
|
|
@@ -172,7 +172,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
172
172
|
domain_id: "99",
|
|
173
173
|
}),
|
|
174
174
|
periodicity: "daily",
|
|
175
|
-
})
|
|
175
|
+
}),
|
|
176
176
|
);
|
|
177
177
|
});
|
|
178
178
|
});
|
|
@@ -183,7 +183,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
183
183
|
|
|
184
184
|
const rendered = render(
|
|
185
185
|
<SubscriptionForm onSubmit={onSubmit} />,
|
|
186
|
-
renderOpts
|
|
186
|
+
renderOpts,
|
|
187
187
|
);
|
|
188
188
|
await waitForLoad(rendered);
|
|
189
189
|
|
|
@@ -212,7 +212,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
212
212
|
resource_name: "MySource",
|
|
213
213
|
}),
|
|
214
214
|
periodicity: "daily",
|
|
215
|
-
})
|
|
215
|
+
}),
|
|
216
216
|
);
|
|
217
217
|
});
|
|
218
218
|
});
|
|
@@ -223,7 +223,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
223
223
|
|
|
224
224
|
const rendered = render(
|
|
225
225
|
<SubscriptionForm onSubmit={onSubmit} />,
|
|
226
|
-
renderOpts
|
|
226
|
+
renderOpts,
|
|
227
227
|
);
|
|
228
228
|
await waitForLoad(rendered);
|
|
229
229
|
|
|
@@ -235,7 +235,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
235
235
|
|
|
236
236
|
await user.click(rendered.getByText(/daily/i));
|
|
237
237
|
await user.click(
|
|
238
|
-
await rendered.findByText(/quality_control_version_draft_created/i)
|
|
238
|
+
await rendered.findByText(/quality_control_version_draft_created/i),
|
|
239
239
|
);
|
|
240
240
|
|
|
241
241
|
const saveButton = rendered.getByRole("button", { name: "actions.save" });
|
|
@@ -253,7 +253,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
253
253
|
resource_name: "MyQC",
|
|
254
254
|
}),
|
|
255
255
|
periodicity: "daily",
|
|
256
|
-
})
|
|
256
|
+
}),
|
|
257
257
|
);
|
|
258
258
|
});
|
|
259
259
|
});
|
|
@@ -264,18 +264,18 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
264
264
|
|
|
265
265
|
const rendered = render(
|
|
266
266
|
<SubscriptionForm onSubmit={onSubmit} />,
|
|
267
|
-
renderOpts
|
|
267
|
+
renderOpts,
|
|
268
268
|
);
|
|
269
269
|
await waitForLoad(rendered);
|
|
270
270
|
|
|
271
271
|
await user.click(rendered.getByText(/email/i));
|
|
272
272
|
|
|
273
273
|
await waitFor(() =>
|
|
274
|
-
expect(rendered.getByTestId("email-input")).toBeInTheDocument()
|
|
274
|
+
expect(rendered.getByTestId("email-input")).toBeInTheDocument(),
|
|
275
275
|
);
|
|
276
276
|
|
|
277
277
|
const emailInput = within(rendered.getByTestId("email-input")).getByRole(
|
|
278
|
-
"textbox"
|
|
278
|
+
"textbox",
|
|
279
279
|
);
|
|
280
280
|
await user.type(emailInput, "test@example.com");
|
|
281
281
|
|
|
@@ -296,7 +296,7 @@ describe("<SubscriptionForm /> lazy selectors and email", () => {
|
|
|
296
296
|
expect(onSubmit).toHaveBeenCalledWith(
|
|
297
297
|
expect.objectContaining({
|
|
298
298
|
subscriber: { type: "email", identifier: "test@example.com" },
|
|
299
|
-
})
|
|
299
|
+
}),
|
|
300
300
|
);
|
|
301
301
|
});
|
|
302
302
|
});
|
package/src/hooks/useEvents.js
CHANGED
|
@@ -4,7 +4,7 @@ import { API_EVENTS } from "../api";
|
|
|
4
4
|
|
|
5
5
|
export const useEvents = (resource_id, resource_type) => {
|
|
6
6
|
const { data, error } = useSWR(API_EVENTS, () =>
|
|
7
|
-
apiJson(API_EVENTS, { params: { resource_id, resource_type } })
|
|
7
|
+
apiJson(API_EVENTS, { params: { resource_id, resource_type } }),
|
|
8
8
|
);
|
|
9
9
|
return { data: data?.data, error, loading: !error && !data };
|
|
10
10
|
};
|
package/src/messages/index.js
CHANGED
|
@@ -21,37 +21,37 @@ describe("reducers: auditRedirect", () => {
|
|
|
21
21
|
|
|
22
22
|
it("should handle the clearRedirect.TRIGGER action", () => {
|
|
23
23
|
expect(auditRedirect("foo", { type: clearRedirect.TRIGGER })).toEqual(
|
|
24
|
-
initialState
|
|
24
|
+
initialState,
|
|
25
25
|
);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it("should handle the createSubscription.SUCCESS action", () => {
|
|
29
29
|
expect(
|
|
30
|
-
auditRedirect("foo", { type: createSubscription.SUCCESS, payload })
|
|
30
|
+
auditRedirect("foo", { type: createSubscription.SUCCESS, payload }),
|
|
31
31
|
).toBe(url);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
it("should handle the createSubscription.SUCCESS action without redirect", () => {
|
|
35
35
|
expect(
|
|
36
|
-
auditRedirect("foo", { type: createSubscription.SUCCESS, payload: {} })
|
|
36
|
+
auditRedirect("foo", { type: createSubscription.SUCCESS, payload: {} }),
|
|
37
37
|
).toBe("foo");
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it("should handle the deleteSubscription.SUCCESS action", () => {
|
|
41
41
|
expect(
|
|
42
|
-
auditRedirect("foo", { type: deleteSubscription.SUCCESS, payload })
|
|
42
|
+
auditRedirect("foo", { type: deleteSubscription.SUCCESS, payload }),
|
|
43
43
|
).toBe(redirect);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it("should handle the deleteSubscription.SUCCESS action without redirect", () => {
|
|
47
47
|
expect(
|
|
48
|
-
auditRedirect("foo", { type: deleteSubscription.SUCCESS, payload: {} })
|
|
48
|
+
auditRedirect("foo", { type: deleteSubscription.SUCCESS, payload: {} }),
|
|
49
49
|
).toBe("foo");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it("should handle the updateSubscription.SUCCESS action", () => {
|
|
53
53
|
expect(
|
|
54
|
-
auditRedirect("foo", { type: updateSubscription.SUCCESS, payload })
|
|
54
|
+
auditRedirect("foo", { type: updateSubscription.SUCCESS, payload }),
|
|
55
55
|
).toBe(url);
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: creatingSubscription", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should be true after receiving the createSubscription.TRIGGER action", () => {
|
|
12
12
|
expect(
|
|
13
|
-
creatingSubscription(false, { type: createSubscription.TRIGGER })
|
|
13
|
+
creatingSubscription(false, { type: createSubscription.TRIGGER }),
|
|
14
14
|
).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should be false after receiving the createSubscription.FULFILL action", () => {
|
|
18
18
|
expect(
|
|
19
|
-
creatingSubscription(true, { type: createSubscription.FULFILL })
|
|
19
|
+
creatingSubscription(true, { type: createSubscription.FULFILL }),
|
|
20
20
|
).toBe(false);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -8,13 +8,13 @@ describe("reducers: notificationsSaving", () => {
|
|
|
8
8
|
|
|
9
9
|
it("should be true after receiving the createNotification.REQUEST action", () => {
|
|
10
10
|
expect(
|
|
11
|
-
notificationSaving(false, { type: createNotification.REQUEST })
|
|
11
|
+
notificationSaving(false, { type: createNotification.REQUEST }),
|
|
12
12
|
).toBe(true);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it("should be false after receiving the notificationSaving.FULFILL action", () => {
|
|
16
16
|
expect(notificationSaving(true, { type: createNotification.FULFILL })).toBe(
|
|
17
|
-
false
|
|
17
|
+
false,
|
|
18
18
|
);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
@@ -18,13 +18,13 @@ describe("reducers: notifications", () => {
|
|
|
18
18
|
|
|
19
19
|
it("should handle the clearNotifications.TRIGGER action", () => {
|
|
20
20
|
expect(notifications(fooState, { type: clearNotifications.TRIGGER })).toBe(
|
|
21
|
-
initialState
|
|
21
|
+
initialState,
|
|
22
22
|
);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should handle the fetchNotifications.TRIGGER action", () => {
|
|
26
26
|
expect(notifications(fooState, { type: fetchNotifications.TRIGGER })).toBe(
|
|
27
|
-
initialState
|
|
27
|
+
initialState,
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ describe("reducers: notifications", () => {
|
|
|
35
35
|
];
|
|
36
36
|
const payload = { data };
|
|
37
37
|
expect(
|
|
38
|
-
notifications(fooState, { type: fetchNotifications.SUCCESS, payload })
|
|
38
|
+
notifications(fooState, { type: fetchNotifications.SUCCESS, payload }),
|
|
39
39
|
).toMatchObject(data);
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -53,7 +53,7 @@ describe("reducers: unread notifications", () => {
|
|
|
53
53
|
unreadNotifications(undefined, {
|
|
54
54
|
type: fetchNotifications.SUCCESS,
|
|
55
55
|
payload,
|
|
56
|
-
})
|
|
56
|
+
}),
|
|
57
57
|
).toEqual({
|
|
58
58
|
list: [{ id: 7 }],
|
|
59
59
|
counter: 1,
|
|
@@ -62,7 +62,7 @@ describe("reducers: unread notifications", () => {
|
|
|
62
62
|
|
|
63
63
|
it("should handle the readNotification.TRIGGER action", () => {
|
|
64
64
|
expect(
|
|
65
|
-
unreadNotifications(initialState, { type: readNotification.TRIGGER })
|
|
65
|
+
unreadNotifications(initialState, { type: readNotification.TRIGGER }),
|
|
66
66
|
).toBe(initialState);
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -71,8 +71,8 @@ describe("reducers: unread notifications", () => {
|
|
|
71
71
|
expect(
|
|
72
72
|
unreadNotifications(
|
|
73
73
|
{ list: [{ id: 3 }, { id: 2 }], counter: 2 },
|
|
74
|
-
{ type: readNotification.REQUEST, payload }
|
|
75
|
-
)
|
|
74
|
+
{ type: readNotification.REQUEST, payload },
|
|
75
|
+
),
|
|
76
76
|
).toMatchObject({ list: [{ id: 3 }], counter: 1 });
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: notificationsLoading", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should be true after receiving the fetchNotifications.TRIGGER action", () => {
|
|
12
12
|
expect(
|
|
13
|
-
notificationsLoading(false, { type: fetchNotifications.TRIGGER })
|
|
13
|
+
notificationsLoading(false, { type: fetchNotifications.TRIGGER }),
|
|
14
14
|
).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should be false after receiving the fetchNotifications.FULFILL action", () => {
|
|
18
18
|
expect(
|
|
19
|
-
notificationsLoading(true, { type: fetchNotifications.FULFILL })
|
|
19
|
+
notificationsLoading(true, { type: fetchNotifications.FULFILL }),
|
|
20
20
|
).toBe(false);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -15,7 +15,7 @@ describe("reducers: searchSubscription", () => {
|
|
|
15
15
|
|
|
16
16
|
it("should handle the searchSubscriptions.TRIGGER action", () => {
|
|
17
17
|
expect(
|
|
18
|
-
searchSubscription(fooState, { type: searchSubscriptions.TRIGGER })
|
|
18
|
+
searchSubscription(fooState, { type: searchSubscriptions.TRIGGER }),
|
|
19
19
|
).toEqual(initialState);
|
|
20
20
|
});
|
|
21
21
|
|
|
@@ -41,13 +41,13 @@ describe("reducers: searchSubscription", () => {
|
|
|
41
41
|
searchSubscription(fooState, {
|
|
42
42
|
type: searchSubscriptions.SUCCESS,
|
|
43
43
|
payload,
|
|
44
|
-
})
|
|
44
|
+
}),
|
|
45
45
|
).toMatchObject(subs);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
it("should handle the clearSubscriptionsSearch.TRIGGER action", () => {
|
|
49
49
|
expect(
|
|
50
|
-
searchSubscription(fooState, { type: clearSubscriptionsSearch.TRIGGER })
|
|
50
|
+
searchSubscription(fooState, { type: clearSubscriptionsSearch.TRIGGER }),
|
|
51
51
|
).toEqual(initialState);
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: subscription", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should handle the clearSubscription.TRIGGER action", () => {
|
|
12
12
|
expect(subscription(fooState, { type: clearSubscription.TRIGGER })).toBe(
|
|
13
|
-
initialState
|
|
13
|
+
initialState,
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should handle the fetchSubscription.TRIGGER action", () => {
|
|
18
18
|
expect(subscription(fooState, { type: fetchSubscription.TRIGGER })).toBe(
|
|
19
|
-
initialState
|
|
19
|
+
initialState,
|
|
20
20
|
);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ describe("reducers: subscription", () => {
|
|
|
27
27
|
];
|
|
28
28
|
const payload = { data };
|
|
29
29
|
expect(
|
|
30
|
-
subscription(fooState, { type: fetchSubscription.SUCCESS, payload })
|
|
30
|
+
subscription(fooState, { type: fetchSubscription.SUCCESS, payload }),
|
|
31
31
|
).toMatchObject(data);
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: subscriptionLoading", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should be true after receiving the fetchSubscription.TRIGGER action", () => {
|
|
12
12
|
expect(
|
|
13
|
-
subscriptionLoading(false, { type: fetchSubscription.TRIGGER })
|
|
13
|
+
subscriptionLoading(false, { type: fetchSubscription.TRIGGER }),
|
|
14
14
|
).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should be false after receiving the fetchSubscription.FULFILL action", () => {
|
|
18
18
|
expect(subscriptionLoading(true, { type: fetchSubscription.FULFILL })).toBe(
|
|
19
|
-
false
|
|
19
|
+
false,
|
|
20
20
|
);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -12,7 +12,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
12
12
|
expect(
|
|
13
13
|
subscriptionUpdating(false, {
|
|
14
14
|
type: createSubscription.TRIGGER,
|
|
15
|
-
})
|
|
15
|
+
}),
|
|
16
16
|
).toBe(true);
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
20
20
|
expect(
|
|
21
21
|
subscriptionUpdating(true, {
|
|
22
22
|
type: createSubscription.SUCCESS,
|
|
23
|
-
})
|
|
23
|
+
}),
|
|
24
24
|
).toBe(false);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
28
28
|
expect(
|
|
29
29
|
subscriptionUpdating(true, {
|
|
30
30
|
type: createSubscription.FAILURE,
|
|
31
|
-
})
|
|
31
|
+
}),
|
|
32
32
|
).toBe(false);
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -36,7 +36,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
36
36
|
expect(
|
|
37
37
|
subscriptionUpdating(false, {
|
|
38
38
|
type: updateSubscription.TRIGGER,
|
|
39
|
-
})
|
|
39
|
+
}),
|
|
40
40
|
).toBe(true);
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
44
44
|
expect(
|
|
45
45
|
subscriptionUpdating(true, {
|
|
46
46
|
type: updateSubscription.SUCCESS,
|
|
47
|
-
})
|
|
47
|
+
}),
|
|
48
48
|
).toBe(false);
|
|
49
49
|
});
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ describe("reducers: ruleSubscriptionLoading", () => {
|
|
|
52
52
|
expect(
|
|
53
53
|
subscriptionUpdating(true, {
|
|
54
54
|
type: updateSubscription.FAILURE,
|
|
55
|
-
})
|
|
55
|
+
}),
|
|
56
56
|
).toBe(false);
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: subscriptions", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should handle the clearSubscriptions.TRIGGER action", () => {
|
|
12
12
|
expect(subscriptions(fooState, { type: clearSubscriptions.TRIGGER })).toBe(
|
|
13
|
-
initialState
|
|
13
|
+
initialState,
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should handle the fetchSubscriptions.TRIGGER action", () => {
|
|
18
18
|
expect(subscriptions(fooState, { type: fetchSubscriptions.TRIGGER })).toBe(
|
|
19
|
-
initialState
|
|
19
|
+
initialState,
|
|
20
20
|
);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ describe("reducers: subscriptions", () => {
|
|
|
27
27
|
];
|
|
28
28
|
const payload = { data };
|
|
29
29
|
expect(
|
|
30
|
-
subscriptions(fooState, { type: fetchSubscriptions.SUCCESS, payload })
|
|
30
|
+
subscriptions(fooState, { type: fetchSubscriptions.SUCCESS, payload }),
|
|
31
31
|
).toMatchObject(data);
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -10,13 +10,13 @@ describe("reducers: subscriptionsLoading", () => {
|
|
|
10
10
|
|
|
11
11
|
it("should be true after receiving the fetchSubscriptions.TRIGGER action", () => {
|
|
12
12
|
expect(
|
|
13
|
-
subscriptionsLoading(false, { type: fetchSubscriptions.TRIGGER })
|
|
13
|
+
subscriptionsLoading(false, { type: fetchSubscriptions.TRIGGER }),
|
|
14
14
|
).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should be false after receiving the fetchSubscriptions.FULFILL action", () => {
|
|
18
18
|
expect(
|
|
19
|
-
subscriptionsLoading(true, { type: fetchSubscriptions.FULFILL })
|
|
19
|
+
subscriptionsLoading(true, { type: fetchSubscriptions.FULFILL }),
|
|
20
20
|
).toBe(false);
|
|
21
21
|
});
|
|
22
22
|
|
|
@@ -2,7 +2,7 @@ import { testSaga } from "redux-saga-test-plan";
|
|
|
2
2
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
3
3
|
import {
|
|
4
4
|
createNotificationRequestSaga,
|
|
5
|
-
createNotificationSaga
|
|
5
|
+
createNotificationSaga,
|
|
6
6
|
} from "../createNotification";
|
|
7
7
|
import { createNotification } from "../../routines";
|
|
8
8
|
import { API_NOTIFICATIONS } from "../../api";
|
|
@@ -39,7 +39,7 @@ describe("sagas: createNotificationSaga", () => {
|
|
|
39
39
|
message,
|
|
40
40
|
resource: { name, description },
|
|
41
41
|
uri,
|
|
42
|
-
recipients
|
|
42
|
+
recipients,
|
|
43
43
|
};
|
|
44
44
|
const data = { status: 202 };
|
|
45
45
|
const requestData = { notification: { ...payload } };
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "@truedat/core/routines";
|
|
7
7
|
import {
|
|
8
8
|
createSubscriptionRequestSaga,
|
|
9
|
-
createSubscriptionSaga
|
|
9
|
+
createSubscriptionSaga,
|
|
10
10
|
} from "../createSubscription";
|
|
11
11
|
import { API_SUBSCRIPTIONS } from "../../api";
|
|
12
12
|
|
|
@@ -36,8 +36,8 @@ describe("sagas: createSubscriptionSaga", () => {
|
|
|
36
36
|
scope: {
|
|
37
37
|
resource_id: 2,
|
|
38
38
|
resource_type: "resource",
|
|
39
|
-
events: ["event"]
|
|
40
|
-
}
|
|
39
|
+
events: ["event"],
|
|
40
|
+
},
|
|
41
41
|
};
|
|
42
42
|
const payload = { subscription };
|
|
43
43
|
|
|
@@ -45,9 +45,9 @@ describe("sagas: createSubscriptionSaga", () => {
|
|
|
45
45
|
subscription: {
|
|
46
46
|
...subscription,
|
|
47
47
|
subscriber: {
|
|
48
|
-
type: "user"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
48
|
+
type: "user",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
it("should put a success action when a response is returned", () => {
|
|
@@ -58,10 +58,10 @@ describe("sagas: createSubscriptionSaga", () => {
|
|
|
58
58
|
.next()
|
|
59
59
|
.call(apiJsonPost, API_SUBSCRIPTIONS, requestData, JSON_OPTS)
|
|
60
60
|
.next({
|
|
61
|
-
data: requestData
|
|
61
|
+
data: requestData,
|
|
62
62
|
})
|
|
63
63
|
.put({
|
|
64
|
-
...createSubscription.success({ data: requestData, ...payload })
|
|
64
|
+
...createSubscription.success({ data: requestData, ...payload }),
|
|
65
65
|
})
|
|
66
66
|
.next()
|
|
67
67
|
.put(
|
|
@@ -69,7 +69,7 @@ describe("sagas: createSubscriptionSaga", () => {
|
|
|
69
69
|
resource_id: 2,
|
|
70
70
|
resource_type: "resource",
|
|
71
71
|
events: ["event"],
|
|
72
|
-
})
|
|
72
|
+
}),
|
|
73
73
|
)
|
|
74
74
|
.next()
|
|
75
75
|
.put(createSubscription.fulfill())
|
|
@@ -30,7 +30,7 @@ describe("sagas: fetchEventsSaga", () => {
|
|
|
30
30
|
const payload = { resource_id: id, resource_type: "data_structure" };
|
|
31
31
|
const data = [
|
|
32
32
|
{ id: 1, service: "My invented service 1", resource_id: id },
|
|
33
|
-
{ id: 2, service: "My invented service 2", resource_id: id }
|
|
33
|
+
{ id: 2, service: "My invented service 2", resource_id: id },
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
it("should put a success action when a response is returned", () => {
|
|
@@ -3,7 +3,7 @@ import { testSaga } from "redux-saga-test-plan";
|
|
|
3
3
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
4
|
import {
|
|
5
5
|
fetchNotificationsRequestSaga,
|
|
6
|
-
fetchNotificationsSaga
|
|
6
|
+
fetchNotificationsSaga,
|
|
7
7
|
} from "../fetchNotifications";
|
|
8
8
|
import { fetchNotifications } from "../../routines";
|
|
9
9
|
import { API_NOTIFICATIONS_SEARCH } from "../../api";
|
|
@@ -33,7 +33,7 @@ describe("sagas: fetchNotificationsSaga", () => {
|
|
|
33
33
|
const body = {};
|
|
34
34
|
|
|
35
35
|
const data = {
|
|
36
|
-
collection: [{ id: 1 }, { id: 2 }]
|
|
36
|
+
collection: [{ id: 1 }, { id: 2 }],
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
it("should put a success action when a response is returned", () => {
|
|
@@ -4,7 +4,7 @@ import { testSaga } from "redux-saga-test-plan";
|
|
|
4
4
|
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
5
|
import {
|
|
6
6
|
fetchSubscriptionRequestSaga,
|
|
7
|
-
fetchSubscriptionSaga
|
|
7
|
+
fetchSubscriptionSaga,
|
|
8
8
|
} from "../fetchSubscription";
|
|
9
9
|
import { fetchSubscription } from "../../routines";
|
|
10
10
|
import { API_SUBSCRIPTION } from "../../api";
|
|
@@ -3,7 +3,7 @@ import { testSaga } from "redux-saga-test-plan";
|
|
|
3
3
|
import { apiJson, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
4
|
import {
|
|
5
5
|
fetchSubscriptionsRequestSaga,
|
|
6
|
-
fetchSubscriptionsSaga
|
|
6
|
+
fetchSubscriptionsSaga,
|
|
7
7
|
} from "../fetchSubscriptions";
|
|
8
8
|
import { fetchSubscriptions } from "../../routines";
|
|
9
9
|
import { API_SUBSCRIPTIONS } from "../../api";
|
|
@@ -32,7 +32,7 @@ describe("sagas: fetchSubscriptionsSaga", () => {
|
|
|
32
32
|
const url = API_SUBSCRIPTIONS;
|
|
33
33
|
|
|
34
34
|
const data = {
|
|
35
|
-
collection: [{ id: 1 }, { id: 2 }]
|
|
35
|
+
collection: [{ id: 1 }, { id: 2 }],
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
it("should put a success action when a response is returned", () => {
|
|
@@ -4,7 +4,7 @@ import { searchSubscriptions } from "@truedat/core/routines";
|
|
|
4
4
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
5
5
|
import {
|
|
6
6
|
searchSubscriptionsRequestSaga,
|
|
7
|
-
searchSubscriptionsSaga
|
|
7
|
+
searchSubscriptionsSaga,
|
|
8
8
|
} from "../searchSubscriptions";
|
|
9
9
|
import { API_SUBSCRIPTIONS_SEARCH } from "../../api";
|
|
10
10
|
|
|
@@ -35,17 +35,17 @@ describe("sagas: searchSubscriptionsSaga", () => {
|
|
|
35
35
|
const payload = {
|
|
36
36
|
resource_id: id,
|
|
37
37
|
events: ["event"],
|
|
38
|
-
resource_type: "concept"
|
|
38
|
+
resource_type: "concept",
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
const body = {
|
|
42
42
|
filters: {
|
|
43
|
-
scope: _.pick(["resource_id", "resource_type", "events"])(payload)
|
|
44
|
-
}
|
|
43
|
+
scope: _.pick(["resource_id", "resource_type", "events"])(payload),
|
|
44
|
+
},
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
const data = {
|
|
48
|
-
collection: [{ id: 1 }, { id: 2 }]
|
|
48
|
+
collection: [{ id: 1 }, { id: 2 }],
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
it("should put a success action when a response is returned", () => {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { call, put, takeLatest } from "redux-saga/effects";
|
|
3
3
|
import { apiJsonPost, JSON_OPTS } from "@truedat/core/services/api";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createSubscription,
|
|
6
|
+
searchSubscriptions,
|
|
7
|
+
} from "@truedat/core/routines";
|
|
5
8
|
import { API_SUBSCRIPTIONS } from "../api";
|
|
6
9
|
|
|
7
10
|
export function* createSubscriptionSaga({ payload }) {
|
|
@@ -26,7 +29,7 @@ export function* createSubscriptionSaga({ payload }) {
|
|
|
26
29
|
yield put(createSubscription.success({ data, ...payload }));
|
|
27
30
|
const searchPayload = _.pick(
|
|
28
31
|
["resource_id", "resource_type", "events"],
|
|
29
|
-
scope
|
|
32
|
+
scope,
|
|
30
33
|
);
|
|
31
34
|
if (!_.isEmpty(searchPayload)) {
|
|
32
35
|
yield put(searchSubscriptions.trigger(searchPayload));
|
|
@@ -34,7 +34,7 @@ export function* deleteSubscriptionSaga({ payload }) {
|
|
|
34
34
|
const events =
|
|
35
35
|
resource_type === "concept" ? CONCEPT_EVENTS : ["rule_result_created"];
|
|
36
36
|
yield put(
|
|
37
|
-
searchSubscriptions.trigger({ resource_id, resource_type, events })
|
|
37
|
+
searchSubscriptions.trigger({ resource_id, resource_type, events }),
|
|
38
38
|
);
|
|
39
39
|
} catch (error) {
|
|
40
40
|
if (error.response) {
|
|
@@ -29,7 +29,7 @@ export function* updateSubscriptionSaga({ payload }) {
|
|
|
29
29
|
const scope = _.get("scope")(subscription);
|
|
30
30
|
const searchPayload = _.pick(
|
|
31
31
|
["resource_id", "resource_type", "events"],
|
|
32
|
-
scope
|
|
32
|
+
scope,
|
|
33
33
|
);
|
|
34
34
|
if (!_.isEmpty(searchPayload)) {
|
|
35
35
|
yield put(searchSubscriptions.trigger(searchPayload));
|
|
@@ -56,8 +56,8 @@ export const isHiddenPairedEvent = (event) =>
|
|
|
56
56
|
export const expandPairedEvents = (events = []) =>
|
|
57
57
|
_.uniq(
|
|
58
58
|
_.flatMap((event) =>
|
|
59
|
-
PAIRED_EVENTS[event] ? [event, PAIRED_EVENTS[event]] : [event]
|
|
60
|
-
)(events)
|
|
59
|
+
PAIRED_EVENTS[event] ? [event, PAIRED_EVENTS[event]] : [event],
|
|
60
|
+
)(events),
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
export const visibleEvents = (events = []) =>
|