Skip to main content
Glama
cli.test.ts1.13 kB
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { parseArgs } from '../src/cli.js'; vi.mock('commander', () => { const mockCommand = { name: vi.fn().mockReturnThis(), description: vi.fn().mockReturnThis(), version: vi.fn().mockReturnThis(), option: vi.fn().mockReturnThis(), parse: vi.fn(), opts: vi.fn().mockReturnValue({ file: 'test.xlsx' }), }; return { Command: vi.fn(() => mockCommand), }; }); vi.mock('../src/auth.js', () => { return { default: vi.fn().mockImplementation(() => ({ getToken: vi.fn().mockResolvedValue('mock-token'), logout: vi.fn().mockResolvedValue(true), })), }; }); vi.spyOn(process.stderr, 'write').mockImplementation(() => true); vi.spyOn(process, 'exit').mockImplementation(() => {}); describe('CLI Module', () => { beforeEach(() => { vi.clearAllMocks(); }); afterEach(() => { vi.resetAllMocks(); }); describe('parseArgs', () => { it('should return command options', () => { const result = parseArgs(); expect(result).toEqual({ file: 'test.xlsx' }); }); }); });

Latest Blog Posts

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/Softeria/ms-365-mcp-server'

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