Files
openclaw/extensions/msteams/src/block-streaming-config.test.ts
Brad Groux 6b0e74000d fix(msteams): add blockStreaming config and progressive delivery (#56134)
- 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
2026-03-27 23:53:24 -05:00

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);
});
});