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 { render, screen } from "@testing-library/svelte";
import { describe, expect, it } from "vitest";
import SettingsGridTest from "$components/layout/SettingsGridTest.svelte";
describe("SettingsGrid.svelte", () => {
it("should render multiple children using a wrapper component", () => {
render(SettingsGridTest);
const settingsGrid = document.querySelector(".settings-grid");
expect(settingsGrid).toBeInTheDocument();
expect(screen.getByTestId("item1")).toBeInTheDocument();
expect(screen.getByTestId("item2")).toBeInTheDocument();
expect(screen.getByTestId("item3")).toBeInTheDocument();
const items = settingsGrid.querySelectorAll('div[data-testid]');
expect(items.length).toBe(3);
});
});