From e7bf6898ac4574a23bd9112af35c121f3098eb4d Mon Sep 17 00:00:00 2001 From: Emma Mansell <73774046+7emansell@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:52:00 -0500 Subject: [PATCH] Tests corrected --- .../NewSettings/UsernameForm.test.tsx | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/components/MyAccount/NewSettings/UsernameForm.test.tsx b/src/components/MyAccount/NewSettings/UsernameForm.test.tsx index 333b902e4..fb0b924c6 100644 --- a/src/components/MyAccount/NewSettings/UsernameForm.test.tsx +++ b/src/components/MyAccount/NewSettings/UsernameForm.test.tsx @@ -68,11 +68,7 @@ describe("username form", () => { render(component) fireEvent.click(screen.getByRole("button", { name: /edit/i })) - expect( - screen.getByLabelText( - "Must be 5-15 characters and use only letters (a-z) and numbers (0-9)" - ) - ).toBeInTheDocument() + expect(screen.getByLabelText("Username")).toBeInTheDocument() expect( screen.getByDisplayValue(processedPatron.username) ).toBeInTheDocument() @@ -89,9 +85,7 @@ describe("username form", () => { fireEvent.click(screen.getByRole("button", { name: /edit/i })) - const input = screen.getByLabelText( - "Must be 5-15 characters and use only letters (a-z) and numbers (0-9)" - ) + const input = screen.getByLabelText("Username") fireEvent.change(input, { target: { value: "!!!!!" } }) expect(screen.getByRole("button", { name: /save changes/i })).toBeDisabled() @@ -102,9 +96,7 @@ describe("username form", () => { fireEvent.click(screen.getByRole("button", { name: /edit/i })) - const input = screen.getByLabelText( - "Must be 5-15 characters and use only letters (a-z) and numbers (0-9)" - ) + const input = screen.getByLabelText("Username") fireEvent.change(input, { target: { value: "" } }) expect(screen.getByRole("button", { name: /save changes/i })).toBeDisabled() @@ -127,9 +119,7 @@ describe("username form", () => { fireEvent.click(screen.getByRole("button", { name: /edit/i })) - const input = screen.getByLabelText( - "Must be 5-15 characters and use only letters (a-z) and numbers (0-9)" - ) + const input = screen.getByLabelText("Username") fireEvent.change(input, { target: { value: "newUsername" } }) fireEvent.click(screen.getByRole("button", { name: /save changes/i })) @@ -151,9 +141,7 @@ describe("username form", () => { fireEvent.click(screen.getByRole("button", { name: /edit/i })) - const input = screen.getByLabelText( - "Must be 5-15 characters and use only letters (a-z) and numbers (0-9)" - ) + const input = screen.getByLabelText("Username") fireEvent.change(input, { target: { value: "modification" } }) fireEvent.click(screen.getByRole("button", { name: /cancel/i }))