-
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.
- Loading branch information
Showing
5 changed files
with
146 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,50 +2,83 @@ import "@testing-library/jest-dom"; | |
import { render, screen } from "@testing-library/react"; | ||
import { AppHeaderComponent } from "@/components/app-header"; | ||
|
||
jest.mock("next/image", () => ({ | ||
__esModule: true, | ||
default: (props: any) => <img {...props} />, | ||
})); | ||
|
||
jest.mock("next/link", () => ({ | ||
__esModule: true, | ||
default: ({ | ||
children, | ||
href, | ||
}: { | ||
children: React.ReactNode; | ||
href: string; | ||
}) => <a href={href}>{children}</a>, | ||
})); | ||
|
||
describe("AppHeaderComponent", () => { | ||
it("renders the App Header Component and associated content", () => { | ||
beforeEach(() => { | ||
render(<AppHeaderComponent />); | ||
}); | ||
|
||
const moultrieLogo = screen.getByRole("img", { | ||
name: "Moultrie Animal Clinic Logo", | ||
}); | ||
it("renders the Moultrie Animal Clinic logo", () => { | ||
const logo = screen.getByAltText( | ||
"Small Moultrie Animal Clinic dog and cat logo." | ||
); | ||
expect(logo).toBeInTheDocument(); | ||
expect(logo).toHaveAttribute("src"); | ||
}); | ||
|
||
const homeLink = screen.getByRole("link", { | ||
name: "Home", | ||
}); | ||
const meetOurTeamLink = screen.getByRole("link", { | ||
name: "Meet Our Team", | ||
}); | ||
const ourServicesLink = screen.getByRole("link", { | ||
name: "Our Services", | ||
}); | ||
const takeATourLink = screen.getByRole("link", { | ||
name: "Take a Tour", | ||
}); | ||
const newClientsLink = screen.getByRole("link", { | ||
name: "New Clients", | ||
}); | ||
const onlinePharmacyLink = screen.getByRole("link", { | ||
name: "Online Pharmacy", | ||
}); | ||
it("renders navigation links with correct hrefs", () => { | ||
const navItems = [ | ||
{ href: "/", label: "Home" }, | ||
{ href: "/meet-our-team", label: "Meet Our Team" }, | ||
{ href: "/our-services", label: "Our Services" }, | ||
{ href: "/take-a-tour", label: "Take a Tour" }, | ||
{ href: "/new-clients", label: "New Clients" }, | ||
{ | ||
href: "https://moultrieanimalclinic.securevetsource.com/site/view/site/view/HomeDelivery.pml?retUrl=https://moultrieanimalclinic.com/&cmsTitle=MOULTRIE%20ANIMAL%20CLINIC", | ||
label: "Online Pharmacy", | ||
}, | ||
]; | ||
|
||
const facebookLogo = screen.getByRole("img", { | ||
name: "Facebook Icon", | ||
navItems.forEach(({ href, label }) => { | ||
const link = screen.getByRole("link", { name: label }); | ||
expect(link).toBeInTheDocument(); | ||
expect(link).toHaveAttribute("href", href); | ||
}); | ||
const phoneNumber = screen.getByRole("link", { | ||
name: "+1 (904) 797-5601", | ||
}); | ||
|
||
it("renders social links and contact information", () => { | ||
const facebookLink = screen.getByRole("link", { | ||
name: /visit the moultrie animal clinic facebook/i, | ||
}); | ||
expect(facebookLink).toBeInTheDocument(); | ||
expect(facebookLink).toHaveAttribute( | ||
"href", | ||
"https://www.facebook.com/Moultrieanimalclinic" | ||
); | ||
|
||
expect(moultrieLogo).toBeInTheDocument(); | ||
const phoneLink = screen.getByRole("link", { name: "+1 (904) 797-5601" }); | ||
expect(phoneLink).toBeInTheDocument(); | ||
expect(phoneLink).toHaveAttribute("href", "tel:+19047975601"); | ||
|
||
expect(homeLink).toBeInTheDocument(); | ||
expect(meetOurTeamLink).toBeInTheDocument(); | ||
expect(ourServicesLink).toBeInTheDocument(); | ||
expect(takeATourLink).toBeInTheDocument(); | ||
expect(newClientsLink).toBeInTheDocument(); | ||
expect(onlinePharmacyLink).toBeInTheDocument(); | ||
const emailLink = screen.getByRole("link", { | ||
name: "[email protected]", | ||
}); | ||
expect(emailLink).toBeInTheDocument(); | ||
expect(emailLink).toHaveAttribute( | ||
"href", | ||
"mailto:[email protected]" | ||
); | ||
}); | ||
|
||
expect(facebookLogo).toBeInTheDocument(); | ||
expect(phoneNumber).toBeInTheDocument(); | ||
it("renders the mobile menu", () => { | ||
const mobileMenu = screen.getByRole("button", { | ||
name: "Mobile Toggle Menu", | ||
}); | ||
expect(mobileMenu).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,85 @@ | ||
import "@testing-library/jest-dom"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { ContactPageComponent } from "@/components/contact-page"; | ||
import "@testing-library/jest-dom"; | ||
|
||
describe("ContactPageComponent", () => { | ||
it("renders the Contact Page Component and associated content", () => { | ||
beforeEach(() => { | ||
render(<ContactPageComponent />); | ||
}); | ||
|
||
const contactUsHeading = screen.getByRole("heading", { | ||
name: "Contact Us", | ||
}); | ||
const phoneNumber = screen.getByRole("link", { | ||
name: "+1 (904) 797-5601", | ||
}); | ||
const email = screen.getByRole("link", { | ||
it("renders the Contact Us heading", () => { | ||
const heading = screen.getByRole("heading", { name: "Contact Us" }); | ||
expect(heading).toBeInTheDocument(); | ||
}); | ||
|
||
it("displays correct contact information", () => { | ||
expect(screen.getByText("+1 (904) 797-5601")).toBeInTheDocument(); | ||
expect( | ||
screen.getByText("[email protected]") | ||
).toBeInTheDocument(); | ||
expect(screen.getByText("+1 (904) 794-7170")).toBeInTheDocument(); | ||
expect( | ||
screen.getByText("3450 US Hwy 1 S, Saint Augustine, FL 32086") | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it("contains correct links with proper attributes", () => { | ||
const phoneLink = screen.getByRole("link", { name: "+1 (904) 797-5601" }); | ||
expect(phoneLink).toHaveAttribute("href", "tel:+19047975601"); | ||
|
||
const emailLink = screen.getByRole("link", { | ||
name: "[email protected]", | ||
}); | ||
const faxNumber = screen.getByRole("link", { | ||
name: "+1 (904) 794-7170", | ||
}); | ||
const address = screen.getByRole("link", { | ||
expect(emailLink).toHaveAttribute( | ||
"href", | ||
"mailto:[email protected]" | ||
); | ||
|
||
const faxLink = screen.getByRole("link", { name: "+1 (904) 794-7170" }); | ||
expect(faxLink).toHaveAttribute("href", "tel:+19047947170"); | ||
|
||
const addressLink = screen.getByRole("link", { | ||
name: "3450 US Hwy 1 S, Saint Augustine, FL 32086", | ||
}); | ||
const hoursOfOperatian = screen.getByRole("heading", { | ||
expect(addressLink).toHaveAttribute( | ||
"href", | ||
"https://www.google.com/maps/search/?api=1&query=3450+US+Hwy+1+S,+Saint+Augustine,+FL+32086" | ||
); | ||
expect(addressLink).toHaveAttribute("target", "_blank"); | ||
expect(addressLink).toHaveAttribute("rel", "noopener noreferrer"); | ||
}); | ||
|
||
it("displays Hours of Operation", () => { | ||
const hoursHeading = screen.getByRole("heading", { | ||
name: "Hours of Operation", | ||
}); | ||
const googleMap = screen.getByTitle("Google Map of Moultrie Animal Clinic"); | ||
expect(hoursHeading).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders Google Map", () => { | ||
const map = screen.getByTitle("Google Map of Moultrie Animal Clinic"); | ||
expect(map).toBeInTheDocument(); | ||
}); | ||
|
||
it("renders social media links", () => { | ||
const facebookLink = screen.getByRole("link", { | ||
name: "Facebook Icon", | ||
name: "Visit the Moultrie Animal Clinic Facebook.", | ||
}); | ||
expect(facebookLink).toHaveAttribute( | ||
"href", | ||
"https://www.facebook.com/Moultrieanimalclinic" | ||
); | ||
expect(facebookLink).toHaveAttribute("target", "_blank"); | ||
expect(facebookLink).toHaveAttribute("rel", "noopener noreferrer"); | ||
|
||
const googleLink = screen.getByRole("link", { | ||
name: "Google Icon", | ||
name: "Visit the Moultrie Animial Clinic Google search entry.", | ||
}); | ||
|
||
expect(contactUsHeading).toBeInTheDocument(); | ||
expect(phoneNumber).toBeInTheDocument(); | ||
expect(email).toBeInTheDocument(); | ||
expect(faxNumber).toBeInTheDocument(); | ||
expect(address).toBeInTheDocument(); | ||
expect(hoursOfOperatian).toBeInTheDocument(); | ||
expect(googleMap).toBeInTheDocument(); | ||
expect(facebookLink).toBeInTheDocument(); | ||
expect(googleLink).toBeInTheDocument(); | ||
expect(googleLink).toHaveAttribute( | ||
"href", | ||
"https://www.google.com/search?q=Moultrie+Animal+Clinic" | ||
); | ||
expect(googleLink).toHaveAttribute("target", "_blank"); | ||
expect(googleLink).toHaveAttribute("rel", "noopener noreferrer"); | ||
}); | ||
}); |
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
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