import { describe, it, expect } from "vitest"; import { BROKER_REGISTRY, getBrokerById, getActiveBrokers } from "../src/brokerRegistry"; import { RemovalMethod } from "@shieldai/types"; describe("BrokerRegistry", () => { it("should have brokers registered", () => { expect(BROKER_REGISTRY.length).toBeGreaterThan(0); }); it("should find broker by id", () => { const broker = getBrokerById("whitepages"); expect(broker).toBeDefined(); expect(broker?.name).toBe("Whitepages"); expect(broker?.domain).toBe("whitepages.com"); }); it("should return undefined for unknown broker", () => { const broker = getBrokerById("nonexistent"); expect(broker).toBeUndefined(); }); it("should return only active brokers", () => { const active = getActiveBrokers(); expect(active.length).toBeGreaterThan(0); for (const broker of active) { expect(broker.isActive).toBe(true); } }); it("should have varied removal methods", () => { const methods = new Set(BROKER_REGISTRY.map((b) => b.removalMethod)); expect(methods.has(RemovalMethod.AUTOMATED)).toBe(true); expect(methods.has(RemovalMethod.MANUAL_FORM)).toBe(true); expect(methods.has(RemovalMethod.EMAIL)).toBe(true); }); });