import { describe, expect, it, vi } from "vitest"
import { render } from "@testing-library/react"
import { MemoryRouter } from "react-router-dom"
import HomePage from "@/pages/home/HomePage"
vi.mock("react-router-dom", async () => {
const actual = await vi.importActual("react-router-dom")
return {
...actual,
useNavigate: () => vi.fn(),
}
})
vi.mock("@/store/authStore", () => ({
useAuthStore: (selector: any) => {
const store = {
isAuthenticated: false,
user: null,
setAuth: vi.fn(),
clearAuth: vi.fn(),
}
return selector ? selector(store) : store
},
}))
describe("HomePage", () => {
it("should render without crashing", () => {
const { container } = render(
,
)
expect(container).toBeTruthy()
})
it("should render hero section", () => {
const { container } = render(
,
)
expect(container.querySelector(".hp-hero")).toBeTruthy()
})
it("should render feature section", () => {
const { container } = render(
,
)
expect(container.querySelector(".hp-features")).toBeTruthy()
})
it("should render pricing section", () => {
const { container } = render(
,
)
expect(container.querySelector(".hp-pricing")).toBeTruthy()
})
})