@truedat/auth 8.6.7 → 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 +4 -4
- package/src/groups/api.js +1 -1
- package/src/groups/components/GroupForm.js +2 -2
- package/src/groups/components/GroupUsersTable.js +3 -3
- package/src/groups/components/GroupsSearchLoader.js +1 -1
- package/src/groups/components/__tests__/Group.spec.js +7 -7
- package/src/groups/components/__tests__/GroupForm.spec.js +11 -11
- package/src/groups/components/__tests__/GroupUsersTable.spec.js +1 -1
- package/src/groups/components/__tests__/GroupsSearchLoader.spec.js +1 -1
- package/src/groups/reducers/__tests__/groupRedirect.spec.js +5 -5
- package/src/groups/reducers/__tests__/groupUsers.spec.js +2 -2
- package/src/groups/reducers/__tests__/groupsSearch.spec.js +6 -6
- package/src/groups/sagas/__tests__/deleteGroup.spec.js +1 -1
- package/src/groups/sagas/__tests__/searchGroups.spec.js +2 -2
- package/src/groups/sagas/index.js +2 -2
- package/src/hooks/useUsers.js +1 -1
- package/src/messages/en.js +48 -26
- package/src/messages/es.js +72 -38
- package/src/messages/index.js +1 -1
- package/src/reducers/__tests__/authMessage.spec.js +2 -2
- package/src/roles/components/PermissionGroup.js +1 -1
- package/src/roles/components/Role.js +1 -1
- package/src/roles/components/RoleForm.js +1 -1
- package/src/roles/components/RoleSelector.js +1 -1
- package/src/roles/components/RolesLoader.js +1 -1
- package/src/roles/components/__tests__/RoleRoutes.spec.js +1 -1
- package/src/roles/reducers/__tests__/roles.spec.js +3 -3
- package/src/roles/sagas/__tests__/fetchRoles.spec.js +3 -5
- package/src/roles/sagas/index.js +2 -2
- package/src/sessions/components/Auth0Callback.js +1 -1
- package/src/sessions/components/__tests__/Auth0LoginButton.spec.js +3 -3
- package/src/sessions/components/__tests__/LoginButtons.spec.js +1 -1
- package/src/sessions/components/__tests__/NonceCallback.spec.js +2 -2
- package/src/sessions/components/__tests__/OpenIDConnect.spec.js +2 -2
- package/src/sessions/components/__tests__/PrivateRoute.spec.js +2 -2
- package/src/sessions/components/__tests__/UnauthorizedRoute.spec.js +1 -1
- package/src/sessions/reducers/__tests__/authMethods.spec.js +2 -2
- package/src/sessions/reducers/__tests__/authRedirect.spec.js +1 -1
- package/src/sessions/reducers/__tests__/authentication.spec.js +2 -2
- package/src/sessions/sagas/__tests__/login.spec.js +4 -4
- package/src/sessions/sagas/__tests__/refresh.spec.js +1 -1
- package/src/sessions/sagas/__tests__/token.spec.js +1 -1
- package/src/sessions/sagas/login.js +8 -8
- package/src/sessions/sagas/refresh.js +3 -3
- package/src/sessions/sagas/token.js +2 -2
- package/src/users/components/Password.js +4 -4
- package/src/users/components/UserActions.js +1 -1
- package/src/users/components/UserCards.js +1 -1
- package/src/users/components/UserRoutes.js +1 -1
- package/src/users/components/UserSelector.js +1 -1
- package/src/users/components/UsersSearchLoader.js +1 -1
- package/src/users/components/__tests__/GroupUserCrumbs.spec.js +7 -7
- package/src/users/components/__tests__/Password.spec.js +21 -17
- package/src/users/components/__tests__/UserCards.spec.js +1 -1
- package/src/users/components/__tests__/UserForm.spec.js +20 -16
- package/src/users/components/__tests__/UserGroupAclRow.spec.js +1 -1
- package/src/users/components/__tests__/UserGroupAcls.spec.js +2 -2
- package/src/users/components/__tests__/UserRoutes.spec.js +1 -1
- package/src/users/components/__tests__/UsersAndGroups.spec.js +3 -3
- package/src/users/reducers/__tests__/canInit.spec.js +2 -2
- package/src/users/reducers/__tests__/userRedirect.spec.js +2 -2
- package/src/users/reducers/__tests__/users.spec.js +3 -3
- package/src/users/reducers/__tests__/usersSearch.spec.js +4 -4
- package/src/users/sagas/__tests__/createUser.spec.js +3 -3
- package/src/users/sagas/__tests__/searchUsers.spec.js +2 -2
- package/src/users/sagas/__tests__/updateUser.spec.js +2 -2
- package/src/users/sagas/searchUsers.js +1 -1
- package/src/users/selectors/__tests__/filterUsers.spec.js +3 -3
- package/src/users/selectors/__tests__/getUserAcls.spec.js +6 -6
- package/src/users/selectors/filterUsers.js +2 -2
- package/src/users/selectors/getUserAcls.js +8 -3
- package/src/users/selectors/getUserGroupAcls.js +2 -2
|
@@ -28,13 +28,13 @@ export function* refreshSaga({ payload }) {
|
|
|
28
28
|
apiJsonPost,
|
|
29
29
|
API_SESSIONS_REFRESH,
|
|
30
30
|
{},
|
|
31
|
-
JSON_OPTS
|
|
31
|
+
JSON_OPTS,
|
|
32
32
|
);
|
|
33
33
|
const { token } = data;
|
|
34
34
|
yield call(saveToken, token);
|
|
35
35
|
const { amr, entitlements, exp, groups, role, user_name } = yield call(
|
|
36
36
|
jwtDecode,
|
|
37
|
-
token
|
|
37
|
+
token,
|
|
38
38
|
);
|
|
39
39
|
yield put(
|
|
40
40
|
refreshSession.success({
|
|
@@ -45,7 +45,7 @@ export function* refreshSaga({ payload }) {
|
|
|
45
45
|
role,
|
|
46
46
|
user_name,
|
|
47
47
|
...data,
|
|
48
|
-
})
|
|
48
|
+
}),
|
|
49
49
|
);
|
|
50
50
|
} catch (error) {
|
|
51
51
|
yield put(refreshSession.failure(error.message));
|
|
@@ -17,7 +17,7 @@ export function* readToken() {
|
|
|
17
17
|
if (token) {
|
|
18
18
|
const { amr, entitlements, exp, groups, role, user_name } = yield call(
|
|
19
19
|
jwtDecode,
|
|
20
|
-
token
|
|
20
|
+
token,
|
|
21
21
|
);
|
|
22
22
|
const isExpired = yield call(checkExpired, exp);
|
|
23
23
|
if (!isExpired) {
|
|
@@ -30,7 +30,7 @@ export function* readToken() {
|
|
|
30
30
|
role,
|
|
31
31
|
token,
|
|
32
32
|
user_name,
|
|
33
|
-
})
|
|
33
|
+
}),
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -80,12 +80,12 @@ export const Password = ({
|
|
|
80
80
|
{
|
|
81
81
|
prop: formatMessage({ id: "user.password.current" }),
|
|
82
82
|
value: MIN_LENGTH,
|
|
83
|
-
}
|
|
83
|
+
},
|
|
84
84
|
),
|
|
85
85
|
},
|
|
86
86
|
required: formatMessage(
|
|
87
87
|
{ id: "form.validation.required" },
|
|
88
|
-
{ prop: formatMessage({ id: "user.password.current" }) }
|
|
88
|
+
{ prop: formatMessage({ id: "user.password.current" }) },
|
|
89
89
|
),
|
|
90
90
|
}}
|
|
91
91
|
render={({ field: { onChange, onBlur, value } }) => (
|
|
@@ -119,12 +119,12 @@ export const Password = ({
|
|
|
119
119
|
{
|
|
120
120
|
prop: formatMessage({ id: "user.password.new_password" }),
|
|
121
121
|
value: MIN_LENGTH,
|
|
122
|
-
}
|
|
122
|
+
},
|
|
123
123
|
),
|
|
124
124
|
},
|
|
125
125
|
required: formatMessage(
|
|
126
126
|
{ id: "form.validation.required" },
|
|
127
|
-
{ prop: formatMessage({ id: "user.password.new_password" }) }
|
|
127
|
+
{ prop: formatMessage({ id: "user.password.new_password" }) },
|
|
128
128
|
),
|
|
129
129
|
}}
|
|
130
130
|
render={({ field: { onBlur, onChange, value } }) => (
|
|
@@ -86,7 +86,7 @@ export const UserActions = ({ deleteUser, user: { id, name } }) => {
|
|
|
86
86
|
const availableActions = _.flow(
|
|
87
87
|
_.omitBy(_.isUndefined),
|
|
88
88
|
_.keys,
|
|
89
|
-
_.map((action) => contentActions[action])
|
|
89
|
+
_.map((action) => contentActions[action]),
|
|
90
90
|
)(actions);
|
|
91
91
|
return availableActions;
|
|
92
92
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Routes, Route } from "react-router";
|
|
2
2
|
import { ProtectedRoute, Loader } from "@truedat/core/router";
|
|
3
3
|
import { Divider, Segment } from "semantic-ui-react";
|
|
4
|
-
import Password from "./Password";
|
|
5
4
|
|
|
6
5
|
import GroupsLoader from "../../groups/components/GroupsLoader";
|
|
7
6
|
import GroupLoader from "../../groups/components/GroupLoader";
|
|
@@ -9,6 +8,7 @@ import Group from "../../groups/components/Group";
|
|
|
9
8
|
import GroupUsers from "../../groups/components/GroupUsers";
|
|
10
9
|
import NewGroup from "../../groups/components/NewGroup";
|
|
11
10
|
import EditGroup from "../../groups/components/EditGroup";
|
|
11
|
+
import Password from "./Password";
|
|
12
12
|
import EditUser from "./EditUser";
|
|
13
13
|
import GroupUserCrumbs from "./GroupUserCrumbs";
|
|
14
14
|
import NewUser from "./NewUser";
|
|
@@ -10,7 +10,7 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
10
10
|
|
|
11
11
|
it("renders alias when action is show", () => {
|
|
12
12
|
const rendered = render(
|
|
13
|
-
<GroupUserCrumbs group={group} action="show" groupLoading={false}
|
|
13
|
+
<GroupUserCrumbs group={group} action="show" groupLoading={false} />,
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
expect(rendered.getByText("Admins")).toBeInTheDocument();
|
|
@@ -19,7 +19,7 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
19
19
|
|
|
20
20
|
it("renders alias link when action is add", () => {
|
|
21
21
|
const rendered = render(
|
|
22
|
-
<GroupUserCrumbs group={group} action="add" groupLoading={false}
|
|
22
|
+
<GroupUserCrumbs group={group} action="add" groupLoading={false} />,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
expect(rendered.getByRole("link", { name: /Admins/i })).toBeInTheDocument();
|
|
@@ -27,7 +27,7 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
27
27
|
|
|
28
28
|
it("renders nothing while group is loading", () => {
|
|
29
29
|
const rendered = render(
|
|
30
|
-
<GroupUserCrumbs group={group} action="show" groupLoading
|
|
30
|
+
<GroupUserCrumbs group={group} action="show" groupLoading />,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
expect(rendered.container).toBeEmptyDOMElement();
|
|
@@ -39,7 +39,7 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
39
39
|
group={{ id: "1", name: "", alias: "Admins" }}
|
|
40
40
|
action="show"
|
|
41
41
|
groupLoading={false}
|
|
42
|
-
|
|
42
|
+
/>,
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
expect(rendered.container).toBeEmptyDOMElement();
|
|
@@ -51,11 +51,11 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
51
51
|
group={{ id: "1", name: "administrators" }}
|
|
52
52
|
action="add"
|
|
53
53
|
groupLoading={false}
|
|
54
|
-
|
|
54
|
+
/>,
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
expect(
|
|
58
|
-
rendered.getByRole("link", { name: /administrators/i })
|
|
58
|
+
rendered.getByRole("link", { name: /administrators/i }),
|
|
59
59
|
).toBeInTheDocument();
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -65,7 +65,7 @@ describe("<GroupUserCrumbs />", () => {
|
|
|
65
65
|
group={{ id: "1", name: "administrators" }}
|
|
66
66
|
action="show"
|
|
67
67
|
groupLoading={false}
|
|
68
|
-
|
|
68
|
+
/>,
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
expect(rendered.getByText(/administrators/i)).toBeInTheDocument();
|
|
@@ -19,28 +19,30 @@ describe("<Password />", () => {
|
|
|
19
19
|
|
|
20
20
|
// Submit button should initially be disabled
|
|
21
21
|
await waitFor(() =>
|
|
22
|
-
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
22
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled(),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
await user.type(
|
|
26
26
|
rendered.getByLabelText(/user.password.current/i, { selector: "input" }),
|
|
27
|
-
"oldPassword"
|
|
27
|
+
"oldPassword",
|
|
28
28
|
);
|
|
29
29
|
await user.type(
|
|
30
30
|
rendered.getByLabelText(/user.password.new_password/i, {
|
|
31
31
|
selector: "input",
|
|
32
32
|
}),
|
|
33
|
-
"Va1id.pa$$w0rd!"
|
|
33
|
+
"Va1id.pa$$w0rd!",
|
|
34
34
|
);
|
|
35
35
|
await user.type(
|
|
36
36
|
rendered.getByLabelText(/login.form.re_password.label/i, {
|
|
37
37
|
selector: "input",
|
|
38
38
|
}),
|
|
39
|
-
"Va1id.pa$$w0rd!"
|
|
39
|
+
"Va1id.pa$$w0rd!",
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
await waitFor(() =>
|
|
43
|
-
expect(
|
|
43
|
+
expect(
|
|
44
|
+
rendered.getByRole("button", { name: /save/i }),
|
|
45
|
+
).not.toBeDisabled(),
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
// Submit
|
|
@@ -52,7 +54,7 @@ describe("<Password />", () => {
|
|
|
52
54
|
old_password: "oldPassword",
|
|
53
55
|
new_password: "Va1id.pa$$w0rd!",
|
|
54
56
|
},
|
|
55
|
-
})
|
|
57
|
+
}),
|
|
56
58
|
);
|
|
57
59
|
});
|
|
58
60
|
|
|
@@ -68,31 +70,33 @@ describe("<Password />", () => {
|
|
|
68
70
|
|
|
69
71
|
// Submit button should initially be disabled
|
|
70
72
|
await waitFor(() =>
|
|
71
|
-
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
73
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled(),
|
|
72
74
|
);
|
|
73
75
|
|
|
74
76
|
// No current password id needed for admin users
|
|
75
77
|
expect(
|
|
76
78
|
await rendered.queryByLabelText(/user.password.current/i, {
|
|
77
79
|
selector: "input",
|
|
78
|
-
})
|
|
80
|
+
}),
|
|
79
81
|
).toBeNull();
|
|
80
82
|
|
|
81
83
|
await user.type(
|
|
82
84
|
rendered.getByLabelText(/user.password.new_password/i, {
|
|
83
85
|
selector: "input",
|
|
84
86
|
}),
|
|
85
|
-
"Va1id.pa$$w0rd!"
|
|
87
|
+
"Va1id.pa$$w0rd!",
|
|
86
88
|
);
|
|
87
89
|
await user.type(
|
|
88
90
|
rendered.getByLabelText(/login.form.re_password.label/i, {
|
|
89
91
|
selector: "input",
|
|
90
92
|
}),
|
|
91
|
-
"Va1id.pa$$w0rd!"
|
|
93
|
+
"Va1id.pa$$w0rd!",
|
|
92
94
|
);
|
|
93
95
|
|
|
94
96
|
await waitFor(() =>
|
|
95
|
-
expect(
|
|
97
|
+
expect(
|
|
98
|
+
rendered.getByRole("button", { name: /save/i }),
|
|
99
|
+
).not.toBeDisabled(),
|
|
96
100
|
);
|
|
97
101
|
|
|
98
102
|
// Submit
|
|
@@ -104,7 +108,7 @@ describe("<Password />", () => {
|
|
|
104
108
|
id: 42,
|
|
105
109
|
new_password: "Va1id.pa$$w0rd!",
|
|
106
110
|
},
|
|
107
|
-
})
|
|
111
|
+
}),
|
|
108
112
|
);
|
|
109
113
|
});
|
|
110
114
|
|
|
@@ -115,11 +119,11 @@ describe("<Password />", () => {
|
|
|
115
119
|
|
|
116
120
|
await user.type(
|
|
117
121
|
rendered.getByLabelText(/user.password.current/i, { selector: "input" }),
|
|
118
|
-
"short"
|
|
122
|
+
"short",
|
|
119
123
|
);
|
|
120
124
|
|
|
121
125
|
expect(
|
|
122
|
-
await rendered.findByText(/form.validation.minLength/i)
|
|
126
|
+
await rendered.findByText(/form.validation.minLength/i),
|
|
123
127
|
).not.toBeNull();
|
|
124
128
|
});
|
|
125
129
|
|
|
@@ -133,18 +137,18 @@ describe("<Password />", () => {
|
|
|
133
137
|
rendered.getByLabelText(/user.password.new_password/i, {
|
|
134
138
|
selector: "input",
|
|
135
139
|
}),
|
|
136
|
-
"Va1id.pa$$w0rd!"
|
|
140
|
+
"Va1id.pa$$w0rd!",
|
|
137
141
|
);
|
|
138
142
|
user.type(
|
|
139
143
|
rendered.getByLabelText(/login.form.re_password.label/i, {
|
|
140
144
|
selector: "input",
|
|
141
145
|
}),
|
|
142
|
-
"different"
|
|
146
|
+
"different",
|
|
143
147
|
);
|
|
144
148
|
});
|
|
145
149
|
|
|
146
150
|
expect(
|
|
147
|
-
await rendered.findByText(/user.password.must.match/i)
|
|
151
|
+
await rendered.findByText(/user.password.must.match/i),
|
|
148
152
|
).not.toBeNull();
|
|
149
153
|
});
|
|
150
154
|
});
|
|
@@ -51,7 +51,7 @@ describe("<UserCards />", () => {
|
|
|
51
51
|
|
|
52
52
|
expect(rendered.container.querySelectorAll(".card")).toHaveLength(1);
|
|
53
53
|
expect(
|
|
54
|
-
rendered.queryByText(/user.search.no_results/i)
|
|
54
|
+
rendered.queryByText(/user.search.no_results/i),
|
|
55
55
|
).not.toBeInTheDocument();
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -29,8 +29,8 @@ describe("<UserForm />", () => {
|
|
|
29
29
|
// Should show validation error
|
|
30
30
|
await waitFor(() =>
|
|
31
31
|
expect(
|
|
32
|
-
rendered.getByText(/form.validation.email.invalid/i)
|
|
33
|
-
).toBeInTheDocument()
|
|
32
|
+
rendered.getByText(/form.validation.email.invalid/i),
|
|
33
|
+
).toBeInTheDocument(),
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
// Clear and type a valid email
|
|
@@ -41,8 +41,8 @@ describe("<UserForm />", () => {
|
|
|
41
41
|
// Should not show validation error
|
|
42
42
|
await waitFor(() =>
|
|
43
43
|
expect(
|
|
44
|
-
rendered.queryByText(/form.validation.email.invalid/i)
|
|
45
|
-
).not.toBeInTheDocument()
|
|
44
|
+
rendered.queryByText(/form.validation.email.invalid/i),
|
|
45
|
+
).not.toBeInTheDocument(),
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ describe("<UserForm />", () => {
|
|
|
50
50
|
const onSubmit = jest.fn();
|
|
51
51
|
const rendered = render(
|
|
52
52
|
<UserForm onSubmit={(props) => onSubmit(props)} />,
|
|
53
|
-
renderOpts
|
|
53
|
+
renderOpts,
|
|
54
54
|
);
|
|
55
55
|
await waitForLoad(rendered);
|
|
56
56
|
|
|
@@ -58,17 +58,17 @@ describe("<UserForm />", () => {
|
|
|
58
58
|
|
|
59
59
|
// Submit button should initially be disabled
|
|
60
60
|
await waitFor(() =>
|
|
61
|
-
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled()
|
|
61
|
+
expect(rendered.getByRole("button", { name: /save/i })).toBeDisabled(),
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
// Input name, full name, password, password confirmation
|
|
65
65
|
await user.type(
|
|
66
66
|
rendered.getByRole("textbox", { name: /user_name/i }),
|
|
67
|
-
"fred"
|
|
67
|
+
"fred",
|
|
68
68
|
);
|
|
69
69
|
await user.type(
|
|
70
70
|
rendered.getByRole("textbox", { name: /full_name/i }),
|
|
71
|
-
"Fred"
|
|
71
|
+
"Fred",
|
|
72
72
|
);
|
|
73
73
|
await user.type(rendered.getByText("user.form.password"), "abc123456");
|
|
74
74
|
await user.type(rendered.getByText(/confirm/i), "abc123456");
|
|
@@ -79,7 +79,9 @@ describe("<UserForm />", () => {
|
|
|
79
79
|
|
|
80
80
|
// Submit button should now be enabled
|
|
81
81
|
await waitFor(() =>
|
|
82
|
-
expect(
|
|
82
|
+
expect(
|
|
83
|
+
rendered.getByRole("button", { name: /save/i }),
|
|
84
|
+
).not.toBeDisabled(),
|
|
83
85
|
);
|
|
84
86
|
|
|
85
87
|
// Submit
|
|
@@ -95,7 +97,7 @@ describe("<UserForm />", () => {
|
|
|
95
97
|
rep_password: "abc123456",
|
|
96
98
|
role: "admin",
|
|
97
99
|
user_name: "fred",
|
|
98
|
-
})
|
|
100
|
+
}),
|
|
99
101
|
);
|
|
100
102
|
});
|
|
101
103
|
|
|
@@ -115,7 +117,7 @@ describe("<UserForm />", () => {
|
|
|
115
117
|
await user.click(rendered.getByRole("combobox"));
|
|
116
118
|
|
|
117
119
|
await waitFor(() =>
|
|
118
|
-
expect(rendered.getByText("Administrators")).toBeInTheDocument()
|
|
120
|
+
expect(rendered.getByText("Administrators")).toBeInTheDocument(),
|
|
119
121
|
);
|
|
120
122
|
expect(rendered.getByText("Users")).toBeInTheDocument();
|
|
121
123
|
});
|
|
@@ -143,19 +145,19 @@ describe("<UserForm />", () => {
|
|
|
143
145
|
...renderOpts.state,
|
|
144
146
|
groups,
|
|
145
147
|
},
|
|
146
|
-
}
|
|
148
|
+
},
|
|
147
149
|
);
|
|
148
150
|
await waitForLoad(rendered);
|
|
149
151
|
|
|
150
152
|
const user = userEvent.setup({ delay: null });
|
|
151
153
|
const groupsDropdown = rendered.container.querySelector(
|
|
152
|
-
'.ui.dropdown[name="groups"]'
|
|
154
|
+
'.ui.dropdown[name="groups"]',
|
|
153
155
|
);
|
|
154
156
|
const externalIdInput = rendered.getByRole("textbox", {
|
|
155
157
|
name: /external_id/i,
|
|
156
158
|
});
|
|
157
159
|
const selectedGroupDeleteIcon = rendered.container.querySelector(
|
|
158
|
-
'.ui.dropdown[name="groups"] .ui.label[value="zzz"] .delete.icon'
|
|
160
|
+
'.ui.dropdown[name="groups"] .ui.label[value="zzz"] .delete.icon',
|
|
159
161
|
);
|
|
160
162
|
|
|
161
163
|
await user.click(groupsDropdown);
|
|
@@ -164,7 +166,9 @@ describe("<UserForm />", () => {
|
|
|
164
166
|
await user.type(externalIdInput, "ext-123");
|
|
165
167
|
|
|
166
168
|
await waitFor(() =>
|
|
167
|
-
expect(
|
|
169
|
+
expect(
|
|
170
|
+
rendered.getByRole("button", { name: /save/i }),
|
|
171
|
+
).not.toBeDisabled(),
|
|
168
172
|
);
|
|
169
173
|
|
|
170
174
|
await user.click(rendered.getByRole("button", { name: /save/i }));
|
|
@@ -177,7 +181,7 @@ describe("<UserForm />", () => {
|
|
|
177
181
|
groups: ["admins", "ZZZ"],
|
|
178
182
|
role: "user",
|
|
179
183
|
user_name: "fred",
|
|
180
|
-
})
|
|
184
|
+
}),
|
|
181
185
|
);
|
|
182
186
|
});
|
|
183
187
|
});
|
|
@@ -47,11 +47,11 @@ describe("<UserGroupAcls />", () => {
|
|
|
47
47
|
},
|
|
48
48
|
]}
|
|
49
49
|
/>,
|
|
50
|
-
renderOpts
|
|
50
|
+
renderOpts,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
await waitFor(() =>
|
|
54
|
-
expect(rendered.queryByText(/group one/i)).toBeInTheDocument()
|
|
54
|
+
expect(rendered.queryByText(/group one/i)).toBeInTheDocument(),
|
|
55
55
|
);
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
|
-
import { UserRoutes } from "../UserRoutes";
|
|
4
3
|
import { useAuthorized } from "@truedat/core/hooks/useAuthorized";
|
|
4
|
+
import { UserRoutes } from "../UserRoutes";
|
|
5
5
|
|
|
6
6
|
jest.mock("@truedat/core/hooks/useAuthorized", () => ({
|
|
7
7
|
useAuthorized: jest.fn(() => true),
|
|
@@ -8,21 +8,21 @@ jest.mock(
|
|
|
8
8
|
() =>
|
|
9
9
|
function UserCards() {
|
|
10
10
|
return <div>UserCards</div>;
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
12
|
);
|
|
13
13
|
jest.mock(
|
|
14
14
|
"../UserTabs",
|
|
15
15
|
() =>
|
|
16
16
|
function UserTabs() {
|
|
17
17
|
return <div>UserTabs</div>;
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
);
|
|
20
20
|
jest.mock(
|
|
21
21
|
"../../../groups/components/GroupCards",
|
|
22
22
|
() =>
|
|
23
23
|
function GroupCards() {
|
|
24
24
|
return <div>GroupCards</div>;
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
describe("<UsersAndGroups />", () => {
|
|
@@ -13,7 +13,7 @@ describe("reducers: userRedirect", () => {
|
|
|
13
13
|
|
|
14
14
|
it("should handle the clearRedirect.TRIGGER action", () => {
|
|
15
15
|
expect(userRedirect("foo", { type: clearRedirect.TRIGGER })).toEqual(
|
|
16
|
-
initialState
|
|
16
|
+
initialState,
|
|
17
17
|
);
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -29,7 +29,7 @@ describe("reducers: userRedirect", () => {
|
|
|
29
29
|
const payload = { data: { id: "1" } };
|
|
30
30
|
const url = linkTo.USER({ id: "1" });
|
|
31
31
|
expect(userRedirect("foo", { type: updateUser.SUCCESS, payload })).toBe(
|
|
32
|
-
url
|
|
32
|
+
url,
|
|
33
33
|
);
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -31,7 +31,7 @@ describe("reducers: users", () => {
|
|
|
31
31
|
it("should handle the SUCCESS action", () => {
|
|
32
32
|
const someUsers = [
|
|
33
33
|
{ id: 1, user_name: "Domain 1", full_name: "Desc 1" },
|
|
34
|
-
{ id: 2, user_name: "Domain 2", full_name: "Desc 2" }
|
|
34
|
+
{ id: 2, user_name: "Domain 2", full_name: "Desc 2" },
|
|
35
35
|
];
|
|
36
36
|
|
|
37
37
|
const data = someUsers;
|
|
@@ -39,8 +39,8 @@ describe("reducers: users", () => {
|
|
|
39
39
|
expect(
|
|
40
40
|
users(fooState, {
|
|
41
41
|
type: fetchUsers.SUCCESS,
|
|
42
|
-
payload: { data }
|
|
43
|
-
})
|
|
42
|
+
payload: { data },
|
|
43
|
+
}),
|
|
44
44
|
).toMatchObject(data);
|
|
45
45
|
});
|
|
46
46
|
|
|
@@ -30,14 +30,14 @@ describe("reducers: usersSearch", () => {
|
|
|
30
30
|
|
|
31
31
|
it("should handle the clearUsersSearch.TRIGGER action", () => {
|
|
32
32
|
expect(usersSearch(fooState, { type: clearUsersSearch.TRIGGER })).toEqual(
|
|
33
|
-
initialState
|
|
33
|
+
initialState,
|
|
34
34
|
);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
it("should handle the SUCCESS action", () => {
|
|
38
38
|
const someUsers = [
|
|
39
39
|
{ id: 1, user_name: "Domain 1", full_name: "Desc 1" },
|
|
40
|
-
{ id: 2, user_name: "Domain 2", full_name: "Desc 2" }
|
|
40
|
+
{ id: 2, user_name: "Domain 2", full_name: "Desc 2" },
|
|
41
41
|
];
|
|
42
42
|
|
|
43
43
|
const data = someUsers;
|
|
@@ -45,8 +45,8 @@ describe("reducers: usersSearch", () => {
|
|
|
45
45
|
expect(
|
|
46
46
|
usersSearch(fooState, {
|
|
47
47
|
type: searchUsers.SUCCESS,
|
|
48
|
-
payload: { data }
|
|
49
|
-
})
|
|
48
|
+
payload: { data },
|
|
49
|
+
}),
|
|
50
50
|
).toMatchObject(data);
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -32,13 +32,13 @@ describe("sagas: createUserSaga", () => {
|
|
|
32
32
|
groups: "[]",
|
|
33
33
|
role: "admin",
|
|
34
34
|
password: "xxxx",
|
|
35
|
-
rep_password: "xxxx"
|
|
35
|
+
rep_password: "xxxx",
|
|
36
36
|
};
|
|
37
37
|
const payload = {
|
|
38
|
-
user
|
|
38
|
+
user,
|
|
39
39
|
};
|
|
40
40
|
const request_data = {
|
|
41
|
-
user
|
|
41
|
+
user,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
it("should put a success action when a response is returned", () => {
|
|
@@ -28,8 +28,8 @@ describe("sagas: searchUsersSaga", () => {
|
|
|
28
28
|
const data = {
|
|
29
29
|
collection: [
|
|
30
30
|
{ id: 1, name: "User 1", email: "user1@truedat.net" },
|
|
31
|
-
{ id: 2, name: "User 2", email: "user2@truedat.net" }
|
|
32
|
-
]
|
|
31
|
+
{ id: 2, name: "User 2", email: "user2@truedat.net" },
|
|
32
|
+
],
|
|
33
33
|
};
|
|
34
34
|
const payload = { query: "abc" };
|
|
35
35
|
|
|
@@ -59,7 +59,7 @@ describe("sagas: updateUserSaga", () => {
|
|
|
59
59
|
apiJsonPut,
|
|
60
60
|
API_USER.replace(":id", userId),
|
|
61
61
|
request_data,
|
|
62
|
-
JSON_OPTS
|
|
62
|
+
JSON_OPTS,
|
|
63
63
|
)
|
|
64
64
|
.next({ data: payload })
|
|
65
65
|
.put({ ...updateUser.success(payload) })
|
|
@@ -83,7 +83,7 @@ describe("sagas: updateUserSaga", () => {
|
|
|
83
83
|
apiJsonPut,
|
|
84
84
|
API_USER.replace(":id", userId),
|
|
85
85
|
request_data,
|
|
86
|
-
JSON_OPTS
|
|
86
|
+
JSON_OPTS,
|
|
87
87
|
)
|
|
88
88
|
.throw(error)
|
|
89
89
|
.put(updateUser.failure(message))
|
|
@@ -8,7 +8,7 @@ export function* searchUsersSaga({ payload }) {
|
|
|
8
8
|
try {
|
|
9
9
|
const requestData = _.flow(
|
|
10
10
|
_.omitBy(_.isNil),
|
|
11
|
-
_.pick(["query", "domains", "roles", "permission"])
|
|
11
|
+
_.pick(["query", "domains", "roles", "permission"]),
|
|
12
12
|
)(payload);
|
|
13
13
|
const url = API_USERS_SEARCH;
|
|
14
14
|
yield put(searchUsers.request());
|
|
@@ -5,19 +5,19 @@ describe("selectors: filterUsers", () => {
|
|
|
5
5
|
id: 1,
|
|
6
6
|
email: "email@email.com",
|
|
7
7
|
full_name: "Pepito Pérez",
|
|
8
|
-
user_name: "user"
|
|
8
|
+
user_name: "user",
|
|
9
9
|
};
|
|
10
10
|
const miguel = {
|
|
11
11
|
id: 2,
|
|
12
12
|
email: "email2@email.com",
|
|
13
13
|
full_name: "Miguel Muñoz",
|
|
14
|
-
user_name: "user2"
|
|
14
|
+
user_name: "user2",
|
|
15
15
|
};
|
|
16
16
|
const rosa = {
|
|
17
17
|
id: 3,
|
|
18
18
|
email: "email3@email.com",
|
|
19
19
|
full_name: "Rosa Martin",
|
|
20
|
-
user_name: "user3"
|
|
20
|
+
user_name: "user3",
|
|
21
21
|
};
|
|
22
22
|
const users = [pepito, miguel, rosa];
|
|
23
23
|
|