Dheeraj Murali

@dheerajmurali.com

Carbon based life form

What is MCP? MCP is a protocol that lets software expose real capabilities to AI models. Models decide the “what,” MCP handles the “how.” Instead of hinting at commands, the model can actually run them through a structured interfaces.

Testing "writing to clipboard" with react-testing-library and vitest was not as straightforward as I thought it was. Clipboard is only available in secure env, making them undenied in a test env. How do you test it? Defined the property on navigator object and then spy on it.

Object.defineProperty(navigator, 'clipboard', {
    value: { writeText: vi.fn() },
    configurable: true,
});

it('should write to clipboard' () => {
    vi.spyOn(navigator.clipboard, 'writeText').mockResolveValue();
});