import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { DiscordConnector } from '../src/connectors/discord-connector.js'; describe('Discord connector (communication)', () => { let connector: DiscordConnector; let originalFetch: typeof globalThis.fetch; beforeEach(() => { connector = new DiscordConnector(); originalFetch = globalThis.fetch; }); afterEach(() => { globalThis.fetch = originalFetch; }); it('has correct id, name, and service', () => { expect(connector.id).toBe('discord'); expect(connector.name).toBe('Discord'); expect(connector.service).toBe('discord.com'); }); it('has at least 5 actions', () => { expect(connector.actions.length).toBeGreaterThanOrEqual(5); }); it('execute returns error when not connected', async () => { const result = await connector.execute('list_guilds', {}); expect(result.success).toBe(false); expect(result.error).toContain('Not connected'); }); it('healthCheck returns disconnected when no token', async () => { const health = await connector.healthCheck(); expect(health.status).toBe('disconnected'); }); });