mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:08:26 +00:00
follow-up: align ingress, atomic paths, and channel tests with credential semantics (#33733)
Merged via squash.
Prepared head SHA: c290c2ab6a
Co-authored-by: joshavant <830519+joshavant@users.noreply.github.com>
Co-authored-by: joshavant <830519+joshavant@users.noreply.github.com>
Reviewed-by: @joshavant
This commit is contained in:
@@ -299,6 +299,7 @@ describe("discord tool result dispatch", () => {
|
||||
client,
|
||||
);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
expect(dispatchMock).toHaveBeenCalledTimes(1);
|
||||
expect(sendMock).toHaveBeenCalledTimes(1);
|
||||
},
|
||||
@@ -394,6 +395,7 @@ describe("discord tool result dispatch", () => {
|
||||
client,
|
||||
);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
expect(dispatchMock).toHaveBeenCalledTimes(1);
|
||||
const payload = dispatchMock.mock.calls[0]?.[0]?.ctx as Record<string, unknown>;
|
||||
expect(payload.WasMentioned).toBe(true);
|
||||
@@ -407,6 +409,7 @@ describe("discord tool result dispatch", () => {
|
||||
const client = createThreadClient();
|
||||
await handler(createThreadEvent("m4", threadChannel), client);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
const capturedCtx = getCapturedCtx();
|
||||
expect(capturedCtx?.SessionKey).toBe("agent:main:discord:channel:t1");
|
||||
expect(capturedCtx?.ParentSessionKey).toBe("agent:main:discord:channel:p1");
|
||||
@@ -471,6 +474,7 @@ describe("discord tool result dispatch", () => {
|
||||
const client = createThreadClient({ fetchChannel, restGet });
|
||||
await handler(createThreadEvent("m6"), client);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
const capturedCtx = getCapturedCtx();
|
||||
expect(capturedCtx?.SessionKey).toBe("agent:main:discord:channel:t1");
|
||||
expect(capturedCtx?.ParentSessionKey).toBe("agent:main:discord:channel:forum-1");
|
||||
@@ -497,6 +501,7 @@ describe("discord tool result dispatch", () => {
|
||||
const client = createThreadClient();
|
||||
await handler(createThreadEvent("m5", threadChannel), client);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
const capturedCtx = getCapturedCtx();
|
||||
expect(capturedCtx?.SessionKey).toBe("agent:support:discord:channel:t1");
|
||||
expect(capturedCtx?.ParentSessionKey).toBe("agent:support:discord:channel:p1");
|
||||
|
||||
@@ -158,6 +158,7 @@ describe("discord tool result dispatch", () => {
|
||||
client,
|
||||
);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
expect(capturedCtx?.SessionKey).toBe("agent:main:discord:channel:c1");
|
||||
});
|
||||
|
||||
@@ -181,6 +182,7 @@ describe("discord tool result dispatch", () => {
|
||||
client,
|
||||
);
|
||||
|
||||
await vi.waitFor(() => expect(dispatchMock).toHaveBeenCalledTimes(1));
|
||||
expect(capturedBody).toContain("Ada (Ada#1234): hello");
|
||||
});
|
||||
|
||||
|
||||
@@ -711,8 +711,13 @@ describe("presence-cache", () => {
|
||||
});
|
||||
|
||||
describe("resolveDiscordPresenceUpdate", () => {
|
||||
it("returns null when no presence config provided", () => {
|
||||
expect(resolveDiscordPresenceUpdate({})).toBeNull();
|
||||
it("returns default online presence when no presence config provided", () => {
|
||||
expect(resolveDiscordPresenceUpdate({})).toEqual({
|
||||
status: "online",
|
||||
activities: [],
|
||||
since: null,
|
||||
afk: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("returns status-only presence when activity is omitted", () => {
|
||||
|
||||
@@ -212,14 +212,14 @@ describe("DiscordVoiceManager", () => {
|
||||
|
||||
const manager = createManager();
|
||||
|
||||
await manager.join({ guildId: "g1", channelId: "c1" });
|
||||
await manager.join({ guildId: "g1", channelId: "c2" });
|
||||
await manager.join({ guildId: "g1", channelId: "1001" });
|
||||
await manager.join({ guildId: "g1", channelId: "1002" });
|
||||
|
||||
const oldDisconnected = oldConnection.handlers.get("disconnected");
|
||||
expect(oldDisconnected).toBeTypeOf("function");
|
||||
await oldDisconnected?.();
|
||||
|
||||
expectConnectedStatus(manager, "c2");
|
||||
expectConnectedStatus(manager, "1002");
|
||||
});
|
||||
|
||||
it("keeps the new session when an old destroyed handler fires", async () => {
|
||||
@@ -229,14 +229,14 @@ describe("DiscordVoiceManager", () => {
|
||||
|
||||
const manager = createManager();
|
||||
|
||||
await manager.join({ guildId: "g1", channelId: "c1" });
|
||||
await manager.join({ guildId: "g1", channelId: "c2" });
|
||||
await manager.join({ guildId: "g1", channelId: "1001" });
|
||||
await manager.join({ guildId: "g1", channelId: "1002" });
|
||||
|
||||
const oldDestroyed = oldConnection.handlers.get("destroyed");
|
||||
expect(oldDestroyed).toBeTypeOf("function");
|
||||
oldDestroyed?.();
|
||||
|
||||
expectConnectedStatus(manager, "c2");
|
||||
expectConnectedStatus(manager, "1002");
|
||||
});
|
||||
|
||||
it("removes voice listeners on leave", async () => {
|
||||
@@ -244,7 +244,7 @@ describe("DiscordVoiceManager", () => {
|
||||
joinVoiceChannelMock.mockReturnValueOnce(connection);
|
||||
const manager = createManager();
|
||||
|
||||
await manager.join({ guildId: "g1", channelId: "c1" });
|
||||
await manager.join({ guildId: "g1", channelId: "1001" });
|
||||
await manager.leave({ guildId: "g1" });
|
||||
|
||||
const player = createAudioPlayerMock.mock.results[0]?.value;
|
||||
@@ -262,7 +262,7 @@ describe("DiscordVoiceManager", () => {
|
||||
},
|
||||
});
|
||||
|
||||
await manager.join({ guildId: "g1", channelId: "c1" });
|
||||
await manager.join({ guildId: "g1", channelId: "1001" });
|
||||
|
||||
expect(joinVoiceChannelMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -275,7 +275,7 @@ describe("DiscordVoiceManager", () => {
|
||||
it("attempts rejoin after repeated decrypt failures", async () => {
|
||||
const manager = createManager();
|
||||
|
||||
await manager.join({ guildId: "g1", channelId: "c1" });
|
||||
await manager.join({ guildId: "g1", channelId: "1001" });
|
||||
|
||||
emitDecryptFailure(manager);
|
||||
emitDecryptFailure(manager);
|
||||
|
||||
Reference in New Issue
Block a user