diff --git a/docs/community/index.md b/docs/community/index.md index 2ab9f138a02..0fcfe54d063 100644 --- a/docs/community/index.md +++ b/docs/community/index.md @@ -27,7 +27,7 @@ ElizaOS empowers developers of all skill levels to harness the potential of AI a ## Governance -ai16z originates as being an AI agent led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record. +ai16z originates as being an AI agent-led DAO. Similar to how we can influence the autonomous agents on memecoins to buy, we intend to bring similar functionality for token holders to actively participate in the decision-making process and shape the future of the project. Community members can pitch ideas, provide insights, and influence investment strategies based on their expertise and track record. ## Explore and Contribute diff --git a/docs/docs/core/actions.md b/docs/docs/core/actions.md index 0f710e0c90d..38fe9304921 100644 --- a/docs/docs/core/actions.md +++ b/docs/docs/core/actions.md @@ -164,7 +164,7 @@ interface Action { - **validate**: Determines if the action can be executed - **handler**: Implements the action's behavior - **examples**: Demonstrates proper usage patterns -- **suppressInitialMessage**: When true, suppresses the initial response message before processing the action. Useful for actions that generate their own responses (like image generation) +- **suppressInitialMessage**: When true, suppress the initial response message before processing the action. Useful for actions that generate their own responses (like image generation) --- @@ -179,7 +179,7 @@ const continueAction: Action = { name: "CONTINUE", similes: ["ELABORATE", "KEEP_TALKING"], description: - "Used when the message requires a follow-up. Don't use when the conversation is finished.", + "Used when the message requires a follow-up. Don't use it when the conversation is finished.", validate: async (runtime, message) => { // Validation logic return true; diff --git a/docs/docs/quickstart.md b/docs/docs/quickstart.md index 8267b1e98dd..b8942cb4bc0 100644 --- a/docs/docs/quickstart.md +++ b/docs/docs/quickstart.md @@ -130,7 +130,7 @@ You set which model to use inside the character JSON file pnpm start --character="characters/trump.character.json" ``` - You can also load multiple characters with the characters option with a comma separated list: + You can also load multiple characters with the characters option with a comma-separated list: ```bash pnpm start --characters="characters/trump.character.json,characters/tate.character.json" diff --git a/packages/plugin-solana/__tests__/actions/swap.test.ts b/packages/plugin-solana/__tests__/actions/swap.test.ts new file mode 100644 index 00000000000..f38f806c4e8 --- /dev/null +++ b/packages/plugin-solana/__tests__/actions/swap.test.ts @@ -0,0 +1,22 @@ +import { describe, it, expect, vi } from 'vitest'; + +describe('Swap Action', () => { + describe('validate', () => { + it('should handle swap message validation', async () => { + const mockMessage = { + content: 'Swap 1 SOL to USDC', + metadata: { + fromToken: 'SOL', + toToken: 'USDC', + amount: '1' + } + }; + + // Basic test to ensure message structure + expect(mockMessage.metadata).toBeDefined(); + expect(mockMessage.metadata.fromToken).toBe('SOL'); + expect(mockMessage.metadata.toToken).toBe('USDC'); + expect(mockMessage.metadata.amount).toBe('1'); + }); + }); +}); diff --git a/packages/plugin-solana/__tests__/evaluators/trust.test.ts b/packages/plugin-solana/__tests__/evaluators/trust.test.ts new file mode 100644 index 00000000000..ff7cb8b1343 --- /dev/null +++ b/packages/plugin-solana/__tests__/evaluators/trust.test.ts @@ -0,0 +1,55 @@ +import { describe, it, expect, vi } from 'vitest'; +import { trustEvaluator } from '../../src/evaluators/trust'; + +// Mock the core module +vi.mock('@elizaos/core', () => ({ + generateTrueOrFalse: vi.fn().mockResolvedValue(false), + ModelClass: { + SMALL: 'small' + }, + settings: { + MAIN_WALLET_ADDRESS: 'test-wallet-address' + }, + booleanFooter: 'Answer with Yes or No.', + elizaLogger: { + log: vi.fn(), + debug: vi.fn(), + info: vi.fn(), + error: vi.fn() + }, + composeContext: vi.fn().mockReturnValue({ + state: {}, + template: '' + }) +})); + +describe('Trust Evaluator', () => { + it('should handle non-trust messages', async () => { + const mockRuntime = { + getSetting: vi.fn(), + composeState: vi.fn().mockResolvedValue({ + agentId: 'test-agent', + roomId: 'test-room' + }), + getLogger: vi.fn().mockReturnValue({ + debug: vi.fn(), + info: vi.fn(), + log: vi.fn(), + error: vi.fn() + }) + }; + + const mockMessage = { + content: 'Hello world', + metadata: {} + }; + + const mockState = { + agentId: 'test-agent', + roomId: 'test-room' + }; + + const result = await trustEvaluator.handler(mockRuntime, mockMessage, mockState); + expect(result).toBeDefined(); + }); +}); diff --git a/packages/plugin-solana/__tests__/providers/token-security.test.ts b/packages/plugin-solana/__tests__/providers/token-security.test.ts new file mode 100644 index 00000000000..d350953092d --- /dev/null +++ b/packages/plugin-solana/__tests__/providers/token-security.test.ts @@ -0,0 +1,36 @@ +import { describe, it, expect, vi } from 'vitest'; +import { TokenProvider } from '../../src/providers/token'; +import { WalletProvider } from '../../src/providers/wallet'; +import { ICacheManager } from '@elizaos/core'; + +describe('Token Security', () => { + it('should handle empty security data gracefully', async () => { + const mockCacheManager = { + get: vi.fn().mockResolvedValue(null), + set: vi.fn(), + delete: vi.fn(), + clear: vi.fn(), + has: vi.fn(), + }; + + const mockWalletProvider = new WalletProvider(mockCacheManager); + const tokenProvider = new TokenProvider( + 'So11111111111111111111111111111111111111112', + mockWalletProvider, + mockCacheManager + ); + + global.fetch = vi.fn().mockResolvedValueOnce({ + ok: true, + json: () => Promise.resolve({ + success: true, + data: {} + }) + }); + + const result = await tokenProvider.fetchTokenSecurity(); + expect(result).toBeDefined(); + expect(result.ownerBalance).toBe(undefined); + expect(result.creatorBalance).toBe(undefined); + }); +}); diff --git a/packages/plugin-solana/src/tests/token.test.ts b/packages/plugin-solana/__tests__/token.test.ts similarity index 98% rename from packages/plugin-solana/src/tests/token.test.ts rename to packages/plugin-solana/__tests__/token.test.ts index 6b799c1c239..5d1a5e23451 100644 --- a/packages/plugin-solana/src/tests/token.test.ts +++ b/packages/plugin-solana/__tests__/token.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect, beforeEach, vi, afterEach } from "vitest"; -import { TokenProvider } from "../providers/token.ts"; +import { TokenProvider } from "../src/providers/token.ts"; // Mock NodeCache vi.mock("node-cache", () => {