Skip to content

Commit d054fca

Browse files
committed
make fmt
1 parent be94818 commit d054fca

File tree

8 files changed

+20
-38
lines changed

8 files changed

+20
-38
lines changed

site/src/api/api.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,9 @@ class ApiMethods {
13221322
await this.axios.put(`/api/v2/users/${userId}/password`, updatePassword);
13231323
};
13241324

1325-
validateUserPassword = async (password: string): Promise<TypesGen.ValidateUserPasswordResponse> => {
1325+
validateUserPassword = async (
1326+
password: string,
1327+
): Promise<TypesGen.ValidateUserPasswordResponse> => {
13261328
const response = await this.axios.post("/api/v2/users/validate-password", {
13271329
password,
13281330
});

site/src/pages/CreateUserPage/CreateUserPage.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ export const CreateUserPage: FC = () => {
2020
const authMethodsQuery = useQuery(authMethods());
2121
const validatePasswordMutation = useMutation(validatePassword());
2222

23-
const [passwordValidator, setPasswordValidator] = useState({valid: false, details: ""});
23+
const [passwordValidator, setPasswordValidator] = useState({
24+
valid: false,
25+
details: "",
26+
});
2427

2528
const validateUserPassword = async (password: string) => {
2629
validatePasswordMutation.mutate(password, {
2730
onSuccess: (data) => {
28-
setPasswordValidator({valid: data.valid, details: data.details})
31+
setPasswordValidator({ valid: data.valid, details: data.details });
2932
},
3033
});
3134
};

site/src/pages/SetupPage/SetupPage.test.tsx

-23
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,6 @@ describe("Setup Page", () => {
4949
);
5050
});
5151

52-
it("renders the password validation error", async () => {
53-
server.use(
54-
http.post("/api/v2/users/validate-password", () => {
55-
return HttpResponse.json({ valid: false, details: "Password is too short" });
56-
}),
57-
);
58-
59-
renderWithRouter(
60-
createMemoryRouter(
61-
[
62-
{
63-
path: "/setup",
64-
element: <SetupPage />,
65-
},
66-
],
67-
{ initialEntries: ["/setup"] },
68-
),
69-
);
70-
await waitForLoaderToBeRemoved();
71-
await fillForm({ password: "short" });
72-
await waitFor(() => screen.findByText("Password is too short"));
73-
});
74-
7552
it("redirects to the app when setup is successful", async () => {
7653
let userHasBeenCreated = false;
7754

site/src/pages/SetupPage/SetupPage.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export const SetupPage: FC = () => {
2929
const buildInfoQuery = useQuery(buildInfo(metadata["build-info"]));
3030
const navigate = useNavigate();
3131

32-
const [passwordValidator, setPasswordValidator] = useState({valid: false, details: ""});
32+
const [passwordValidator, setPasswordValidator] = useState({
33+
valid: false,
34+
details: "",
35+
});
3336

3437
useEffect(() => {
3538
if (!buildInfoQuery.data) {
@@ -43,7 +46,7 @@ export const SetupPage: FC = () => {
4346
const validateUserPassword = async (password: string) => {
4447
validatePasswordMutation.mutate(password, {
4548
onSuccess: (data) => {
46-
setPasswordValidator({valid: data.valid, details: data.details})
49+
setPasswordValidator({ valid: data.valid, details: data.details });
4750
},
4851
});
4952
};

site/src/pages/SetupPage/SetupPageView.stories.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ export const TrialError: Story = {
3131
},
3232
};
3333

34-
export const PasswordValidation: Story = {
35-
args: {
36-
passwordValidator: { valid: false, details: "Password is too short" },
37-
},
38-
};
39-
4034
export const Loading: Story = {
4135
args: {
4236
isLoading: true,

site/src/pages/UserSettingsPage/SecurityPage/SecurityForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import LoadingButton from "@mui/lab/LoadingButton";
22
import TextField from "@mui/material/TextField";
3+
import type * as TypesGen from "api/typesGenerated";
34
import { Alert } from "components/Alert/Alert";
45
import { ErrorAlert } from "components/Alert/ErrorAlert";
56
import { Form, FormFields } from "components/Form/Form";
@@ -8,7 +9,6 @@ import type { FC } from "react";
89
import { useEffect } from "react";
910
import { getFormHelpers } from "utils/formUtils";
1011
import * as Yup from "yup";
11-
import type * as TypesGen from "api/typesGenerated";
1212

1313
interface SecurityFormValues {
1414
old_password: string;

site/src/pages/UserSettingsPage/SecurityPage/SecurityPage.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ export const SecurityPage: FC = () => {
2929
});
3030
const singleSignOnSection = useSingleSignOnSection();
3131

32-
const [passwordValidator, setPasswordValidator] = useState({valid: false, details: ""});
32+
const [passwordValidator, setPasswordValidator] = useState({
33+
valid: false,
34+
details: "",
35+
});
3336

3437
const validateUserPassword = async (password: string) => {
3538
validatePasswordMutation.mutate(password, {
3639
onSuccess: (data) => {
37-
setPasswordValidator({valid: data.valid, details: data.details})
40+
setPasswordValidator({ valid: data.valid, details: data.details });
3841
},
3942
});
4043
};

site/src/pages/UserSettingsPage/SecurityPage/SecurityPageView.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const defaultArgs: ComponentProps<typeof SecurityPageView> = {
1616
isLoading: false,
1717
onSubmit: action("onSubmit"),
1818
onPasswordChange: (password: string) => {},
19-
passwordValidator: {valid: false, details: ""},
19+
passwordValidator: { valid: false, details: "" },
2020
},
2121
},
2222
oidc: {

0 commit comments

Comments
 (0)