Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tcm390 committed Feb 13, 2025
1 parent af71043 commit 9c16b07
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/plugin-discord/__tests__/environment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ describe('Discord Environment Configuration', () => {
const invalidRuntime = {
...mockRuntime,
env: {
...mockRuntime.env,
DISCORD_API_TOKEN: undefined,
},
} as IAgentRuntime;

await expect(validateDiscordConfig(invalidRuntime)).rejects.toThrowError(
'Discord configuration validation failed:\nDISCORD_API_TOKEN: Discord API token is required'
'Discord configuration validation failed:\nDISCORD_API_TOKEN: Expected string, received null'
);
});
});
4 changes: 2 additions & 2 deletions packages/plugin-discord/__tests__/message.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, expect, vi, beforeEach } from "vitest";
import { MessageManager } from "../src/messages.ts";
import { ChannelType, Client, Collection, AttachmentBuilder } from "discord.js";
import { type IAgentRuntime, ServiceType } from "@elizaos/core";
import { ChannelType, Client, Collection } from "discord.js";
import { type IAgentRuntime } from "@elizaos/core";
import type { VoiceManager } from "../src/voice";

vi.mock("@elizaos/core", () => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-discord/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function validateDiscordConfig(
try {
const config = {
DISCORD_API_TOKEN:
runtime.getSetting("DISCORD_API_TOKEN") || "",
runtime.getSetting("DISCORD_API_TOKEN"),
};

return discordEnvSchema.parse(config);
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-discord/src/test-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class DiscordTestSuite implements TestSuite {
}
logger.success("DiscordClient successfully initialized.");
} catch (error) {
throw new Error("Error in test creating Discord client:", error);
throw new Error(`Error in test creating Discord client: ${error}`);
}
}

Expand Down

0 comments on commit 9c16b07

Please sign in to comment.