mirror of
https://github.com/MeshCore-Beacon/beacon-web.git
synced 2026-09-09 15:05:34 +00:00
- fresh-row highlights leaked under a steady stream (each new batch cancelled the previous batch's clear timer); per-batch timers in a small useFreshHashes hook now - closing the analyzer drops ?hash and the row selection, so the same row reopens on the next click and a closed analyzer stays closed after reload/share - sf=path / sf=payload from the URL fall back to hash search (only field matchesFilters implements; the UI options were already disabled) - remove the summary preview line no backend path ever populates - channel message rows key on packetHash (live WS messages carry no id)
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
import { MemoryRouter, useLocation } from "react-router-dom";
|
|
import { PacketAnalyzerDrawer } from "../../../src/features/packets/PacketAnalyzerDrawer";
|
|
|
|
function LocationProbe() {
|
|
const location = useLocation();
|
|
return <div data-testid="search">{location.search}</div>;
|
|
}
|
|
|
|
describe("PacketAnalyzerDrawer close", () => {
|
|
it("removes ?hash from the URL and calls onClose", () => {
|
|
const onClose = vi.fn();
|
|
render(
|
|
<MemoryRouter initialEntries={["/?tab=Packets&hash=abc123"]}>
|
|
<PacketAnalyzerDrawer detail={undefined} selectedObservationId={null} onClose={onClose} />
|
|
<LocationProbe />
|
|
</MemoryRouter>,
|
|
);
|
|
|
|
fireEvent.click(screen.getByLabelText("Close analyzer"));
|
|
|
|
expect(onClose).toHaveBeenCalledOnce();
|
|
const search = screen.getByTestId("search").textContent ?? "";
|
|
expect(search).not.toContain("hash=");
|
|
expect(search).toContain("tab=Packets"); // other params survive
|
|
});
|
|
});
|