Download src/plugin-sdk/test-helpers/directory.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 932 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/directory.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/plugin-sdk/test-helpers/directory.ts
-
curl -L -o directory.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/directory.ts
932 Bytes
| /** | |
| * Shared directory adapter fixtures for channel contract tests. | |
| */ | |
| import type { ChannelDirectoryAdapter } from "../channel-contract.js"; | |
| type DirectorySurface = { | |
| listPeers: NonNullable<ChannelDirectoryAdapter["listPeers"]>; | |
| listGroups: NonNullable<ChannelDirectoryAdapter["listGroups"]>; | |
| }; | |
| export function createDirectoryTestRuntime() { | |
| return { | |
| log: () => {}, | |
| error: () => {}, | |
| exit: (code: number): never => { | |
| throw new Error(`exit ${code}`); | |
| }, | |
| }; | |
| } | |
| export function expectDirectorySurface(directory: unknown): DirectorySurface { | |
| if (!directory || typeof directory !== "object") { | |
| throw new Error("expected directory"); | |
| } | |
| const { listPeers, listGroups } = directory as ChannelDirectoryAdapter; | |
| if (!listPeers) { | |
| throw new Error("expected listPeers"); | |
| } | |
| if (!listGroups) { | |
| throw new Error("expected listGroups"); | |
| } | |
| return { | |
| listPeers, | |
| listGroups, | |
| }; | |
| } | |