Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
import { describe, it, expect } from "vitest";
import { CommunityAgentSendRequestSchema } from "../../src/schemas";
describe("CommunityAgentSendRequestSchema — replyToSeq", () => {
it("accepts a valid positive replyToSeq", () => {
const parsed = CommunityAgentSendRequestSchema.safeParse({
channel: "/studio/general",
content: { text: "on it" },
replyToSeq: 37,
});
expect(parsed.success).toBe(true);
if (parsed.success) expect(parsed.data.replyToSeq).toBe(37);
});
it("is optional — a send with no replyToSeq still parses", () => {
const parsed = CommunityAgentSendRequestSchema.safeParse({
channel: "/studio/general",
content: { text: "hi" },
});
expect(parsed.success).toBe(true);
if (parsed.success) expect(parsed.data.replyToSeq).toBeUndefined();
});
it("rejects replyToSeq = 0 (min(1) — 0 is the legacy sentinel, never a real message)", () => {
const parsed = CommunityAgentSendRequestSchema.safeParse({
channel: "/studio/general",
content: { text: "hi" },
replyToSeq: 0,
});
expect(parsed.success).toBe(false);
});
it("rejects a negative replyToSeq", () => {
const parsed = CommunityAgentSendRequestSchema.safeParse({
channel: "/studio/general",
content: { text: "hi" },
replyToSeq: -3,
});
expect(parsed.success).toBe(false);
});
it("rejects a non-integer replyToSeq", () => {
const parsed = CommunityAgentSendRequestSchema.safeParse({
channel: "/studio/general",
content: { text: "hi" },
replyToSeq: 3.5,
});
expect(parsed.success).toBe(false);
});
});
describe("CommunityAgentSendRequestSchema — force", () => {
it.each([true, false, undefined])("accepts optional boolean %s", (force) => {
const result = CommunityAgentSendRequestSchema.parse({ channel: "/s/general", content: { text: "hi" }, force });
expect(result.force).toBe(force);
});
it.each(["true", "false", 1, null])("rejects non-boolean %s", (force) => {
expect(CommunityAgentSendRequestSchema.safeParse({ channel: "/s/general", content: { text: "hi" }, force }).success).toBe(false);
});
});