Testing integrated components
In the previous example, we tested a simple Button
component to make it render properly with the required properties. In this section, we will test a completely integrated component that combines different individual components. Let’s get started with the following steps:
- Create a file inside the
tests/components
directory calledHomeOverivew.vue
since we want to test the integration of the home page. - Open the file and add the following testing code or clone the repository using the GitHub link mentioned in the Technical requirements section:
import { fireEvent, render } from "@testing-library/vue"; import { describe, expect, it } from "vitest"; import HomeOverview from "../../components/templates/HomeOverview.vue"; describe("HomeOverview.vue", () => { it("renders component", async () => { const { getByText } = render(HomeOverview); getByText...