Download src/plugin-sdk/test-helpers/send-config.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/send-config.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/plugin-sdk/test-helpers/send-config.ts
-
curl -L -o send-config.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/plugin-sdk/test-helpers/send-config.ts
1.31 kB
| /** | |
| * Shared assertions for channel send config derivation. | |
| */ | |
| import { expect } from "vitest"; | |
| type MockFn = (...args: never[]) => unknown; | |
| type CfgThreadingAssertion<TCfg> = { | |
| loadConfig: MockFn; | |
| resolveAccount: MockFn; | |
| cfg: TCfg; | |
| accountId?: string; | |
| }; | |
| type SendRuntimeState = { | |
| loadConfig: MockFn; | |
| resolveMarkdownTableMode: MockFn; | |
| convertMarkdownTables: MockFn; | |
| record: MockFn; | |
| }; | |
| export function expectProvidedCfgSkipsRuntimeLoad<TCfg>({ | |
| loadConfig, | |
| resolveAccount, | |
| cfg, | |
| accountId, | |
| }: CfgThreadingAssertion<TCfg>): void { | |
| expect(loadConfig).not.toHaveBeenCalled(); | |
| expect(resolveAccount).toHaveBeenCalledWith({ | |
| cfg, | |
| accountId, | |
| }); | |
| } | |
| export function expectRuntimeCfgFallback<TCfg>({ | |
| loadConfig, | |
| resolveAccount, | |
| cfg, | |
| accountId, | |
| }: CfgThreadingAssertion<TCfg>): void { | |
| expect(loadConfig).toHaveBeenCalledTimes(1); | |
| expect(resolveAccount).toHaveBeenCalledWith({ | |
| cfg, | |
| accountId, | |
| }); | |
| } | |
| export function createSendCfgThreadingRuntime({ | |
| loadConfig, | |
| resolveMarkdownTableMode, | |
| convertMarkdownTables, | |
| record, | |
| }: SendRuntimeState) { | |
| return { | |
| config: { | |
| loadConfig, | |
| }, | |
| channel: { | |
| text: { | |
| resolveMarkdownTableMode, | |
| convertMarkdownTables, | |
| }, | |
| activity: { | |
| record, | |
| }, | |
| }, | |
| }; | |
| } | |