Skip to content

Commit 4151ab5

Browse files
committed
test(notifiations): working on storybook
1 parent 7bded6a commit 4151ab5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ 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(<SetupPage />);
60+
await waitForLoaderToBeRemoved();
61+
await fillForm({ password: "short" });
62+
await waitFor(() => screen.findByText("Password is too short"));
63+
});
64+
5265
it("redirects to the app when setup is successful", async () => {
5366
let userHasBeenCreated = false;
5467

@@ -99,6 +112,7 @@ describe("Setup Page", () => {
99112
await fillForm();
100113
await waitFor(() => screen.findByText("Templates"));
101114
});
115+
102116
it("calls sendBeacon with telemetry", async () => {
103117
const sendBeacon = jest.fn();
104118
Object.defineProperty(window.navigator, "sendBeacon", {

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

Lines changed: 6 additions & 0 deletions
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)