test: add test for svelte components

This commit is contained in:
2026-02-08 04:14:03 +05:00
parent db26272ac5
commit 1a0d99828e
16 changed files with 661 additions and 0 deletions
@@ -0,0 +1,19 @@
import InputGroupTest from "$components/layout/InputGroupTest.svelte";
import { render, screen } from "@testing-library/svelte";
import { describe, expect, it } from "vitest";
describe("InputGroup.svelte", () => {
it("should render multiple children using a wrapper component", () => {
render(InputGroupTest);
const inputGroup = document.querySelector(".input-group");
expect(inputGroup).toBeInTheDocument();
expect(screen.getByTestId("input1")).toBeInTheDocument();
expect(screen.getByTestId("input2")).toBeInTheDocument();
expect(screen.getByTestId("button")).toBeInTheDocument();
const inputs = inputGroup!.querySelectorAll("input");
expect(inputs.length).toBe(2);
});
});