mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 21:50:20 +00:00
- Add blockStreaming and blockStreamingCoalesceDefaults to MSTeams channel plugin (was the only channel missing it) - Wire disableBlockStreaming flag in reply dispatcher from config - Flush pending messages immediately during generation when blockStreaming is enabled - Add comprehensive tests for schema validation and progressive flush behavior Refs #56041
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
// Import the schema directly to avoid cross-extension import chains
|
|
const { MSTeamsConfigSchema } = await import("../../../src/config/zod-schema.providers-core.js");
|
|
|
|
describe("MSTeamsConfigSchema blockStreaming", () => {
|
|
const baseConfig = {
|
|
enabled: true,
|
|
dmPolicy: "open" as const,
|
|
allowFrom: ["*"],
|
|
};
|
|
|
|
it("accepts blockStreaming: true", () => {
|
|
const result = MSTeamsConfigSchema.safeParse({
|
|
...baseConfig,
|
|
blockStreaming: true,
|
|
});
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.blockStreaming).toBe(true);
|
|
}
|
|
});
|
|
|
|
it("accepts blockStreaming: false", () => {
|
|
const result = MSTeamsConfigSchema.safeParse({
|
|
...baseConfig,
|
|
blockStreaming: false,
|
|
});
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.blockStreaming).toBe(false);
|
|
}
|
|
});
|
|
|
|
it("accepts config without blockStreaming (optional)", () => {
|
|
const result = MSTeamsConfigSchema.safeParse(baseConfig);
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.blockStreaming).toBeUndefined();
|
|
}
|
|
});
|
|
|
|
it("accepts blockStreaming alongside blockStreamingCoalesce", () => {
|
|
const result = MSTeamsConfigSchema.safeParse({
|
|
...baseConfig,
|
|
blockStreaming: true,
|
|
blockStreamingCoalesce: { minChars: 100, idleMs: 500 },
|
|
});
|
|
expect(result.success).toBe(true);
|
|
if (result.success) {
|
|
expect(result.data.blockStreaming).toBe(true);
|
|
expect(result.data.blockStreamingCoalesce).toEqual({ minChars: 100, idleMs: 500 });
|
|
}
|
|
});
|
|
|
|
it("rejects non-boolean blockStreaming", () => {
|
|
const result = MSTeamsConfigSchema.safeParse({
|
|
...baseConfig,
|
|
blockStreaming: "yes",
|
|
});
|
|
expect(result.success).toBe(false);
|
|
});
|
|
});
|