Files
beacon-web/tests/components/SearchBar.compact.test.tsx
n30nex d259be512e feat: observer monitoring, retained evidence and channel scopes (#75-#99)
Lands the stacked web PRs #75, #79, #80, #81, #83, #85, #87, #89, #92, #95 and #99 in one squash. Server counterparts #166-#176 are merged. Remaining review items follow in a fix PR.
2026-09-30 08:03:13 -04:00

21 lines
1.0 KiB
TypeScript

import { describe, it, expect, vi } from "vitest";
import { act, fireEvent, render, screen } from "@testing-library/react";
import { SearchBar } from "../../src/components/SearchBar";
describe("compact observer search", () => {
it("omits the field menu and coalesces typing before querying", () => {
vi.useFakeTimers();
try {
const change = vi.fn();
render(<SearchBar value="" onChange={change} fields={[{ value: "name", label: "Name" }]} field="name" onFieldChange={() => {}} hideField inputLabel="Search observers" />);
const input = screen.getByRole("textbox", { name: "Search observers" });
fireEvent.change(input, { target: { value: "Ro" } });
fireEvent.change(input, { target: { value: "Roof" } });
expect(change).not.toHaveBeenCalled();
act(() => vi.advanceTimersByTime(300));
expect(change).toHaveBeenCalledExactlyOnceWith("Roof");
expect(screen.queryByRole("button", { name: /Name/ })).not.toBeInTheDocument();
} finally { vi.useRealTimers(); }
});
});