mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-13 12:13:42 +01:00
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>
33 lines
1.4 KiB
TypeScript
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));
|
|
});
|
|
});
|