Files
yaak-mountain-loop/apps/yaak-proxy/lib/hideSystem.test.ts
T
Gregory SchierandClaude Opus 5.5 ca1494b54a Fill out Yaak Proxy's sidebar menus, and move System's toggle into its menu
Rows for apps, folders, sites, hosts and paths get Filter by This Value,
Exclude This Value and Copy Value, as the list's cells have, covering
every selected row. Opening a row's menu no longer applies the row, so
the menu adds to the filter as it is. System's eye becomes Show in All
Traffic in its menu, and Domains counts its hosts as a plain number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 11:21:31 -07:00

33 lines
1.4 KiB
TypeScript

import { createStore } from "jotai";
import { describe, expect, test, vi } from "vite-plus/test";
// The store reads the engine and the tree's selection through these; the toggle needs neither.
vi.mock("./rpc", () => ({ rpc: vi.fn(), listen: vi.fn() }));
vi.mock("@yaakapp-internal/ui", async () => {
const { atom } = await vi.importActual<typeof import("jotai")>("jotai");
return { selectedIdsFamily: () => atom<string[]>([]) };
});
const { activeQueryAtom, allTrafficTotalAtom, flowTotalAtom, hideSystemAtom, nonSystemTotalAtom } =
await import("./store");
describe("Show in All Traffic, in System's menu", () => {
test("shows System's traffic in All traffic by default", () => {
const store = createStore();
expect(store.get(hideSystemAtom)).toBe(false);
expect(store.get(activeQueryAtom)).toBeNull();
});
test("leaves System out of All traffic and brings it back at once", () => {
const store = createStore();
store.set(nonSystemTotalAtom, 3);
expect(store.get(allTrafficTotalAtom)).toBe(store.get(flowTotalAtom));
store.set(hideSystemAtom, true);
expect(store.get(activeQueryAtom)).toEqual({ query: "", hideSystem: true });
expect(store.get(allTrafficTotalAtom)).toBe(3);
store.set(hideSystemAtom, false);
expect(store.get(activeQueryAtom)).toBeNull();
expect(store.get(allTrafficTotalAtom)).toBe(store.get(flowTotalAtom));
});
});