Skip to content

Commit 277cb57

Browse files
committed
make fmt
1 parent d054fca commit 277cb57

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

site/src/pages/ResetPasswordPage/ChangePasswordPage.stories.tsx

-14
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,6 @@ export const WrongConfirmationPassword: Story = {
5151
},
5252
};
5353

54-
export const PasswordValidation: Story = {
55-
play: async ({ canvasElement }) => {
56-
spyOn(API, "validateUserPassword").mockResolvedValueOnce({
57-
valid: false,
58-
details: "Password is too short",
59-
});
60-
const canvas = within(canvasElement);
61-
const user = userEvent.setup();
62-
const newPasswordInput = await canvas.findByLabelText("Password *");
63-
await user.type(newPasswordInput, "short");
64-
await canvas.findByText("Password is too short");
65-
},
66-
};
67-
6854
export const GeneralServerError: Story = {
6955
play: async ({ canvasElement }) => {
7056
const serverError =

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

+26
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,32 @@ 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({
56+
valid: false,
57+
details: "Password is too short",
58+
});
59+
}),
60+
);
61+
62+
renderWithRouter(
63+
createMemoryRouter(
64+
[
65+
{
66+
path: "/setup",
67+
element: <SetupPage />,
68+
},
69+
],
70+
{ initialEntries: ["/setup"] },
71+
),
72+
);
73+
await waitForLoaderToBeRemoved();
74+
await fillForm({ password: "short" });
75+
await waitFor(() => screen.findByText("Password is too short"));
76+
});
77+
5278
it("redirects to the app when setup is successful", async () => {
5379
let userHasBeenCreated = false;
5480

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

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ 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+
3440
export const Loading: Story = {
3541
args: {
3642
isLoading: true,

0 commit comments

Comments
 (0)