react18-tools/webgl-generative-particles

View on GitHub
lib/src/react/particles/particles.test.tsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { cleanup, render, screen } from "@testing-library/react";
import { afterEach, describe, test } from "vitest";
import { Particles } from "./particles";

describe("particles", () => {
  afterEach(cleanup);

  test("Test if renders without errors", ({ expect }) => {
    const clx = "my-class";
    render(<Particles className={clx} />);
    expect(screen.getByTestId("particles").classList).toContain(clx);
  });

  test("Test fullScreen overlay mode", ({ expect }) => {
    render(<Particles fullScreenOverlay />);
    expect(screen.getByTestId("particles").style.width).toBe("100vw");
  });
});