import { describe, it, expectTypeOf } from "vitest"; import type { EventBusProtocol, RealtimeBroadcasterProtocol, RealtimeRegistryProtocol, } from "./bind-protocols"; // Protocol-shape tests. These verify each protocol type EXPORTS the // expected method names. Full assignability of `IEventBus` / // `IRealtimeBroadcaster` / `IRealtimeHandlerRegistry` to their respective // protocols is verified at the optional-package level — when those packages // are scaffolded back via `pnpm turbo gen core-package `, the // `extends`-link in their interface declarations forces a typecheck // failure if the protocol surface ever drifts. describe("EventBusProtocol", () => { it("requires publish(event, payload) and subscribe(event, consumer, handler)", () => { type Bus = EventBusProtocol; expectTypeOf().toBeFunction(); expectTypeOf().toBeFunction(); }); }); describe("RealtimeBroadcasterProtocol", () => { it("requires broadcast(channel, payload)", () => { type Rt = RealtimeBroadcasterProtocol; expectTypeOf().toBeFunction(); }); }); describe("RealtimeRegistryProtocol", () => { it("requires register, registerChannel, listChannels", () => { type Reg = RealtimeRegistryProtocol; expectTypeOf().toBeFunction(); expectTypeOf().toBeFunction(); expectTypeOf().toBeFunction(); }); });