generated from UoaWDCC/ssr-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Passed tests by adding labels and for
- Loading branch information
1 parent
4573b40
commit 50b27b7
Showing
4 changed files
with
74 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { describe, expect, it, vi } from "vitest"; | ||
import { render, screen, fireEvent } from "@testing-library/react"; | ||
import UserInformationForm from "../../src/components/UserInformationForm"; | ||
import React from "react"; | ||
|
||
describe("UserInformationForm Component", () => { | ||
it("renders the form", () => { | ||
render(<UserInformationForm />); | ||
expect(screen.getByText(/Thanks for Joining/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Thanks for joining/i)).toBeInTheDocument(); | ||
}); | ||
|
||
it("validates form fields", () => { | ||
it("validates form fields", async () => { | ||
render(<UserInformationForm />); | ||
|
||
const submitButton = screen.getByText(/Purchase membership/i); | ||
fireEvent.click(submitButton); | ||
|
||
expect(screen.getByText(/First Name is Required/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Last Name is Required/i)).toBeInTheDocument(); | ||
expect( | ||
screen.getByText(/Your University is Required/i) | ||
).toBeInTheDocument(); | ||
expect( | ||
screen.getByText(/Your Graduation Year is Required/i) | ||
).toBeInTheDocument(); | ||
expect( | ||
screen.getByText(/Membership Type is Required/i) | ||
).toBeInTheDocument(); | ||
expect(await screen.findByText(/First Name is Required/i)).toBeInTheDocument(); | ||
expect(await screen.findByText(/Last Name is Required/i)).toBeInTheDocument(); | ||
expect(await screen.findByText(/Your University is Required/i)).toBeInTheDocument(); | ||
expect(await screen.findByText(/Your Graduation Year is Required/i)).toBeInTheDocument(); | ||
expect(await screen.findByText(/Membership Type is Required/i)).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters