@truedat/audit 7.5.7 → 7.5.10
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 +45 -71
- package/src/components/ContentFilters.js +3 -1
- package/src/components/NotificationEvent.js +2 -2
- package/src/components/NotificationsMenu.js +2 -10
- package/src/components/ShareLinkForm.js +33 -32
- package/src/components/ShareLinkPopup.js +1 -1
- package/src/components/Subscription.js +0 -1
- package/src/components/SubscriptionActions.js +1 -2
- package/src/components/SubscriptionCrumbs.js +2 -3
- package/src/components/SubscriptionEdit.js +0 -1
- package/src/components/SubscriptionForm.js +305 -310
- package/src/components/SubscriptionLoader.js +2 -2
- package/src/components/SubscriptionNew.js +0 -1
- package/src/components/SubscriptionRoutes.js +58 -56
- package/src/components/SubscriptionWatchForm.js +0 -1
- package/src/components/Subscriptions.js +4 -7
- package/src/components/SubscriptionsLoader.js +1 -1
- package/src/components/__tests__/NotificationEvent.spec.js +1 -4
- package/src/components/__tests__/NotificationsMenu.spec.js +0 -1
- package/src/components/__tests__/ShareLinkForm.spec.js +23 -17
- package/src/components/__tests__/ShareLinkPopup.spec.js +0 -1
- package/src/components/__tests__/Subscription.spec.js +0 -1
- package/src/components/__tests__/SubscriptionActions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionCrumbs.spec.js +5 -5
- package/src/components/__tests__/SubscriptionEdit.spec.js +9 -8
- package/src/components/__tests__/SubscriptionForm.spec.js +141 -125
- package/src/components/__tests__/SubscriptionLoader.spec.js +0 -1
- package/src/components/__tests__/SubscriptionNew.spec.js +5 -5
- package/src/components/__tests__/SubscriptionRoutes.spec.js +44 -6
- package/src/components/__tests__/SubscriptionWatchForm.spec.js +37 -34
- package/src/components/__tests__/Subscriptions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionsLoader.spec.js +0 -1
- package/src/components/__tests__/__snapshots__/NotificationEvent.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/NotificationsMenu.spec.js.snap +7 -7
- package/src/components/__tests__/__snapshots__/ShareLinkForm.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +4 -5
- package/src/components/__tests__/__snapshots__/SubscriptionActions.spec.js.snap +0 -1
- package/src/components/__tests__/__snapshots__/SubscriptionCrumbs.spec.js.snap +20 -30
- package/src/components/__tests__/__snapshots__/SubscriptionEdit.spec.js.snap +75 -25
- package/src/components/__tests__/__snapshots__/SubscriptionForm.spec.js.snap +23 -23
- package/src/components/__tests__/__snapshots__/SubscriptionNew.spec.js.snap +64 -25
- package/src/components/__tests__/__snapshots__/SubscriptionRoutes.spec.js.snap +710 -23
- package/src/components/__tests__/__snapshots__/SubscriptionWatchForm.spec.js.snap +83 -80
- package/src/components/__tests__/__snapshots__/Subscriptions.spec.js.snap +28 -37
- package/src/index.js +1 -2
- package/src/reducers/__tests__/auditMessage.spec.js +3 -3
- package/src/reducers/__tests__/auditRedirect.spec.js +2 -2
- package/src/reducers/__tests__/events.spec.js +1 -1
- package/src/reducers/__tests__/searchSubscription.spec.js +5 -5
- package/src/reducers/__tests__/subscription.spec.js +1 -1
- package/src/reducers/__tests__/subscriptionUpdating.spec.js +6 -6
- package/src/reducers/__tests__/subscriptions.spec.js +1 -1
- package/src/reducers/auditMessage.js +1 -1
- package/src/reducers/events.js +1 -1
- package/src/sagas/__tests__/deleteSubscription.spec.js +7 -7
- package/src/sagas/__tests__/fetchSubscription.spec.js +2 -2
- package/src/sagas/__tests__/readNotification.spec.js +2 -2
- package/src/sagas/__tests__/updateSubscription.spec.js +8 -8
- package/src/sagas/createSubscription.js +3 -3
- package/src/sagas/deleteSubscription.js +1 -1
- package/src/sagas/readNotification.js +1 -1
- package/src/sagas/updateSubscription.js +4 -4
- package/src/selectors/__tests__/getRecipients.spec.js +0 -32
- package/src/selectors/getRecipients.js +0 -34
- package/src/selectors/index.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { connect } from "react-redux";
|
|
4
|
-
import { useParams } from "react-router
|
|
4
|
+
import { useParams } from "react-router";
|
|
5
5
|
import { Dimmer, Loader } from "semantic-ui-react";
|
|
6
6
|
import { clearSubscription, fetchSubscription } from "../routines";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Route,
|
|
2
|
+
import { Route, Routes } from "react-router";
|
|
3
3
|
import {
|
|
4
4
|
SUBSCRIPTION,
|
|
5
5
|
SUBSCRIPTIONS,
|
|
@@ -13,68 +13,70 @@ import SubscriptionEdit from "./SubscriptionEdit";
|
|
|
13
13
|
import SubscriptionLoader from "./SubscriptionLoader";
|
|
14
14
|
import SubscriptionsLoader from "./SubscriptionsLoader";
|
|
15
15
|
|
|
16
|
-
const UsersLoader = React.lazy(
|
|
17
|
-
import("@truedat/auth/users/components/UsersLoader")
|
|
16
|
+
const UsersLoader = React.lazy(
|
|
17
|
+
() => import("@truedat/auth/users/components/UsersLoader")
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
const RolesLoader = React.lazy(
|
|
21
|
-
import("@truedat/auth/roles/components/RolesLoader")
|
|
20
|
+
const RolesLoader = React.lazy(
|
|
21
|
+
() => import("@truedat/auth/roles/components/RolesLoader")
|
|
22
22
|
);
|
|
23
23
|
|
|
24
|
-
const TemplatesLoader = React.lazy(
|
|
25
|
-
import("@truedat/
|
|
24
|
+
const TemplatesLoader = React.lazy(
|
|
25
|
+
() => import("@truedat/core/components/TemplatesLoader")
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
export const SubscriptionRoutes = () => (
|
|
29
|
-
<
|
|
30
|
-
<Route
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
29
|
+
<Routes>
|
|
30
|
+
<Route path="subscriptions">
|
|
31
|
+
<Route
|
|
32
|
+
index
|
|
33
|
+
element={
|
|
34
|
+
<>
|
|
35
|
+
<UsersLoader />
|
|
36
|
+
<SubscriptionsLoader />
|
|
37
|
+
<Subscriptions />
|
|
38
|
+
</>
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
<Route
|
|
42
|
+
path="new"
|
|
43
|
+
element={
|
|
44
|
+
<>
|
|
45
|
+
<TemplatesLoader scope="bg" />
|
|
46
|
+
<UsersLoader />
|
|
47
|
+
<RolesLoader />
|
|
48
|
+
<SubscriptionNew />
|
|
49
|
+
</>
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
<Route path=":id">
|
|
53
|
+
<Route
|
|
54
|
+
index
|
|
55
|
+
element={
|
|
56
|
+
<>
|
|
57
|
+
<TemplatesLoader scope="bg" />
|
|
58
|
+
<UsersLoader />
|
|
59
|
+
<SubscriptionLoader />
|
|
60
|
+
<Subscription />
|
|
61
|
+
</>
|
|
62
|
+
}
|
|
63
|
+
/>
|
|
64
|
+
<Route
|
|
65
|
+
path="edit"
|
|
66
|
+
element={
|
|
67
|
+
<>
|
|
68
|
+
<TemplatesLoader scope="bg" />
|
|
69
|
+
<UsersLoader />
|
|
70
|
+
<SubscriptionLoader />
|
|
71
|
+
<SubscriptionEdit />
|
|
72
|
+
</>
|
|
73
|
+
}
|
|
74
|
+
/>
|
|
75
|
+
</Route>
|
|
76
|
+
</Route>
|
|
77
|
+
|
|
78
|
+
<Route path="*" element={null} />
|
|
79
|
+
</Routes>
|
|
78
80
|
);
|
|
79
81
|
|
|
80
82
|
export default SubscriptionRoutes;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { connect } from "react-redux";
|
|
5
4
|
import { useForm, Controller } from "react-hook-form";
|
|
6
|
-
import {
|
|
5
|
+
import { Link } from "react-router";
|
|
6
|
+
import { useNavigate } from "react-router";
|
|
7
7
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
8
8
|
import { SUBSCRIPTION_NEW, linkTo } from "@truedat/core/routes";
|
|
9
9
|
import {
|
|
@@ -65,7 +65,7 @@ export const Subscriptions = ({
|
|
|
65
65
|
subscriptionsLoading: loading,
|
|
66
66
|
users,
|
|
67
67
|
}) => {
|
|
68
|
-
const
|
|
68
|
+
const navigate = useNavigate();
|
|
69
69
|
const { control, watch } = useForm({
|
|
70
70
|
mode: "all",
|
|
71
71
|
defaultValues: {
|
|
@@ -99,7 +99,6 @@ export const Subscriptions = ({
|
|
|
99
99
|
return (
|
|
100
100
|
<Segment>
|
|
101
101
|
<SubscriptionsHeader />
|
|
102
|
-
|
|
103
102
|
<Form>
|
|
104
103
|
<Header
|
|
105
104
|
as="h5"
|
|
@@ -174,14 +173,12 @@ export const Subscriptions = ({
|
|
|
174
173
|
)}
|
|
175
174
|
/>
|
|
176
175
|
</Form>
|
|
177
|
-
|
|
178
176
|
<Label className="rules-label-results">
|
|
179
177
|
<FormattedMessage
|
|
180
178
|
id="subscriptions.retrieved.results"
|
|
181
179
|
values={{ count: orderedSubscriptions.length }}
|
|
182
180
|
/>
|
|
183
181
|
</Label>
|
|
184
|
-
|
|
185
182
|
<Table className="subscription-table" selectable>
|
|
186
183
|
<Table.Header>
|
|
187
184
|
<Table.Row>
|
|
@@ -201,7 +198,7 @@ export const Subscriptions = ({
|
|
|
201
198
|
({ periodicity, scope, subscriber, resource, id }, key) => (
|
|
202
199
|
<Table.Row
|
|
203
200
|
key={key}
|
|
204
|
-
onClick={() =>
|
|
201
|
+
onClick={() => navigate(linkTo.SUBSCRIPTION({ id }))}
|
|
205
202
|
>
|
|
206
203
|
<Table.Cell>
|
|
207
204
|
<Icon name={subscriberIcon(subscriber)} />
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { render } from "@truedat/test/render";
|
|
3
2
|
import NotificationEvent from "../NotificationEvent";
|
|
4
3
|
|
|
5
4
|
jest.mock("@truedat/core/hooks", () => ({ useOnScreen: jest.fn() }));
|
|
6
|
-
|
|
7
|
-
.spyOn(global.Date, "now")
|
|
8
|
-
.mockImplementation(() => new Date("2022-01-01T11:01:58.135Z").valueOf());
|
|
5
|
+
|
|
9
6
|
describe("<NotificationEvent />", () => {
|
|
10
7
|
it("matches the latest snapshot", () => {
|
|
11
8
|
const event = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { waitFor } from "@testing-library/react";
|
|
3
1
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import {
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
4
|
import { ShareLinkForm } from "../ShareLinkForm";
|
|
6
5
|
|
|
7
6
|
describe("<ShareLinkForm />", () => {
|
|
@@ -33,32 +32,39 @@ describe("<ShareLinkForm />", () => {
|
|
|
33
32
|
options,
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
it("matches the latest snapshot", () => {
|
|
37
|
-
const
|
|
38
|
-
|
|
35
|
+
it("matches the latest snapshot", async () => {
|
|
36
|
+
const rendered = render(<ShareLinkForm {...props} />);
|
|
37
|
+
await waitForLoad(rendered);
|
|
38
|
+
expect(rendered.container).toMatchSnapshot();
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it("enables send button when selecting recipient", async () => {
|
|
42
|
-
const
|
|
42
|
+
const rendered = render(<ShareLinkForm {...props} />);
|
|
43
|
+
await waitForLoad(rendered);
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
const user = userEvent.setup({ delay: null });
|
|
46
|
+
expect(rendered.queryByRole("button", { name: /share/i })).toBeDisabled();
|
|
47
|
+
await user.click(await rendered.findByText(/john/i));
|
|
46
48
|
await waitFor(() => {
|
|
47
|
-
expect(
|
|
49
|
+
expect(
|
|
50
|
+
rendered.queryByRole("button", { name: /share/i })
|
|
51
|
+
).not.toBeDisabled();
|
|
48
52
|
});
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
it("invokes function when send button clicked", async () => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
);
|
|
56
|
+
const rendered = render(<ShareLinkForm {...props} />);
|
|
57
|
+
await waitForLoad(rendered);
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const user = userEvent.setup({ delay: null });
|
|
60
|
+
expect(rendered.queryByRole("button", { name: /share/i })).toBeDisabled();
|
|
61
|
+
await user.click(await rendered.findByText(/john/i));
|
|
58
62
|
await waitFor(() => {
|
|
59
|
-
expect(
|
|
63
|
+
expect(
|
|
64
|
+
rendered.queryByRole("button", { name: /share/i })
|
|
65
|
+
).not.toBeDisabled();
|
|
60
66
|
});
|
|
61
|
-
|
|
67
|
+
await user.click(await rendered.findByRole("button", { name: /share/i }));
|
|
62
68
|
await waitFor(() => {
|
|
63
69
|
expect(createNotification.mock.calls.length).toBe(1);
|
|
64
70
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { shallow } from "enzyme";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import SubscriptionCrumbs from "../SubscriptionCrumbs";
|
|
4
3
|
|
|
5
4
|
describe("<SubscriptionCrumbs />", () => {
|
|
6
|
-
it("matches the latest snapshot", () => {
|
|
7
|
-
const
|
|
8
|
-
|
|
5
|
+
it("matches the latest snapshot", async () => {
|
|
6
|
+
const rendered = render(<SubscriptionCrumbs title="CrumbTitle" />);
|
|
7
|
+
await waitForLoad(rendered);
|
|
8
|
+
expect(rendered.container).toMatchSnapshot();
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import SubscriptionEdit from "../SubscriptionEdit";
|
|
4
3
|
|
|
5
4
|
const renderOpts = {
|
|
6
5
|
state: {
|
|
7
|
-
|
|
6
|
+
subscriptionLoading: false,
|
|
8
7
|
subscription: {
|
|
9
|
-
subscriber: { type: "user" },
|
|
8
|
+
subscriber: { type: "user", identifier: "1" },
|
|
9
|
+
resource: { name: "foo" },
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
users: [{ id: 1, full_name: "John Doe" }],
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
describe("<SubscriptionEdit />", () => {
|
|
16
|
-
it("matches the latest snapshot", () => {
|
|
17
|
-
const
|
|
18
|
-
|
|
16
|
+
it("matches the latest snapshot", async () => {
|
|
17
|
+
const rendered = render(<SubscriptionEdit />, renderOpts);
|
|
18
|
+
await waitForLoad(rendered);
|
|
19
|
+
expect(rendered.container).toMatchSnapshot();
|
|
19
20
|
});
|
|
20
21
|
});
|