Skip to main content
Glama

YouTube Knowledge MCP

by efikuta
youtube-client.test.ts1.65 kB
import { describe, it, expect, beforeEach, vi } from 'vitest'; import { YouTubeClient } from '../../src/youtube-client.js'; import { createLogger } from 'winston'; // Mock the googleapis module vi.mock('googleapis', () => ({ google: { youtube: vi.fn(() => ({ search: { list: vi.fn() }, videos: { list: vi.fn() }, channels: { list: vi.fn() }, commentThreads: { list: vi.fn() } })) } })); vi.mock('google-auth-library', () => ({ GoogleAuth: vi.fn(() => ({})) })); describe('YouTubeClient', () => { let client: YouTubeClient; let mockLogger: any; beforeEach(() => { mockLogger = { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() }; client = new YouTubeClient('test-api-key', mockLogger as any, 10000); }); it('should be instantiated with correct parameters', () => { expect(client).toBeDefined(); expect(client).toBeInstanceOf(YouTubeClient); }); it('should have correct quota usage methods', () => { const quotaUsage = client.getQuotaUsage(); expect(quotaUsage).toEqual({ used: 0, limit: 10000, remaining: 10000 }); }); it('should reset quota correctly', () => { client.resetQuota(); expect(mockLogger.info).toHaveBeenCalledWith('YouTube API quota usage reset'); }); }); describe('YouTubeClient Integration', () => { it('should handle API errors gracefully', () => { // This would test actual API error handling // In a real test, you'd mock the API responses expect(true).toBe(true); // Placeholder }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/efikuta/youtube-knowledge-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server