Skip to content

Commit

Permalink
Tests corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
7emansell committed Nov 26, 2024
1 parent 3b317c3 commit e7bf689
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/components/MyAccount/NewSettings/UsernameForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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 }))
Expand All @@ -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 }))
Expand Down

0 comments on commit e7bf689

Please sign in to comment.