@truedat/auth 7.12.3 → 7.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/auth",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.5",
|
|
4
4
|
"description": "Truedat Web Auth",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.12.
|
|
51
|
+
"@truedat/test": "7.12.5",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@apollo/client": "^3.13.8",
|
|
58
|
-
"@truedat/core": "7.12.
|
|
58
|
+
"@truedat/core": "7.12.5",
|
|
59
59
|
"auth0-js": "^9.28.0",
|
|
60
60
|
"axios": "^1.12.0",
|
|
61
61
|
"graphql": "^16.11.0",
|
|
@@ -81,8 +81,7 @@
|
|
|
81
81
|
"redux-saga-routines": "^3.2.3",
|
|
82
82
|
"reselect": "^5.1.1",
|
|
83
83
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
84
|
-
"swr": "^2.3.3"
|
|
85
|
-
"validator": "^13.15.0"
|
|
84
|
+
"swr": "^2.3.3"
|
|
86
85
|
},
|
|
87
86
|
"overrides": {
|
|
88
87
|
"jsdom": "26.1.0",
|
|
@@ -91,5 +90,5 @@
|
|
|
91
90
|
"resolutions": {
|
|
92
91
|
"superagent@npm:^7.1.5": "10.2.3"
|
|
93
92
|
},
|
|
94
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "7d60ce1b280a2815d9b441f38d27b6b8d5b7a694"
|
|
95
94
|
}
|
|
@@ -4,7 +4,6 @@ import { useIntl } from "react-intl";
|
|
|
4
4
|
import { useForm, useWatch, Controller } from "react-hook-form";
|
|
5
5
|
import { Button, Form } from "semantic-ui-react";
|
|
6
6
|
import { connect } from "react-redux";
|
|
7
|
-
import isEmail from "validator/lib/isEmail";
|
|
8
7
|
import { HistoryBackButton } from "@truedat/core/components";
|
|
9
8
|
|
|
10
9
|
const toOption = (g, i) => ({ key: i, text: g, value: g });
|
|
@@ -26,6 +25,10 @@ const userTypeOptions = (formatMessage) => [
|
|
|
26
25
|
{ text: formatMessage({ id: "user.type.agent" }), value: "agent" },
|
|
27
26
|
];
|
|
28
27
|
|
|
28
|
+
const isEmail = (value) => {
|
|
29
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
30
|
+
};
|
|
31
|
+
|
|
29
32
|
export const PasswordFormFields = ({ control, errors }) => {
|
|
30
33
|
const { formatMessage } = useIntl();
|
|
31
34
|
const password = useWatch({ control, name: "password", defaultValue: "" });
|
|
@@ -15,6 +15,36 @@ describe("<UserForm />", () => {
|
|
|
15
15
|
await waitForLoad(rendered);
|
|
16
16
|
expect(rendered.container).toMatchSnapshot();
|
|
17
17
|
});
|
|
18
|
+
it("validates email format", async () => {
|
|
19
|
+
const rendered = render(<UserForm />, renderOpts);
|
|
20
|
+
await waitForLoad(rendered);
|
|
21
|
+
|
|
22
|
+
const user = userEvent.setup({ delay: null });
|
|
23
|
+
|
|
24
|
+
// Type an invalid email
|
|
25
|
+
const emailInput = rendered.getByRole("textbox", { name: /email/i });
|
|
26
|
+
await user.type(emailInput, "invalid-email");
|
|
27
|
+
await user.tab();
|
|
28
|
+
|
|
29
|
+
// Should show validation error
|
|
30
|
+
await waitFor(() =>
|
|
31
|
+
expect(
|
|
32
|
+
rendered.getByText(/form.validation.email.invalid/i)
|
|
33
|
+
).toBeInTheDocument()
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Clear and type a valid email
|
|
37
|
+
await user.clear(emailInput);
|
|
38
|
+
await user.type(emailInput, "valid@example.com");
|
|
39
|
+
await user.tab();
|
|
40
|
+
|
|
41
|
+
// Should not show validation error
|
|
42
|
+
await waitFor(() =>
|
|
43
|
+
expect(
|
|
44
|
+
rendered.queryByText(/form.validation.email.invalid/i)
|
|
45
|
+
).not.toBeInTheDocument()
|
|
46
|
+
);
|
|
47
|
+
});
|
|
18
48
|
|
|
19
49
|
it("calls the onSubmit function when submitted", async () => {
|
|
20
50
|
const onSubmit = jest.fn();
|