testing-patterns-nodejs

Installation
SKILL.md

Testing Couchbase Node.js Applications

Unit Testing

Mock the collection object using Jest. Install: npm install --save-dev jest.

test('getUser returns correct document', async () => {
    const mockGet = jest.fn().mockResolvedValue({
        content: { name: 'Alice', email: 'alice@example.com' }
    });
    const mockCollection = { get: mockGet };

    const repo = new UserRepository(mockCollection);
    const user = await repo.getUser('user::alice');
Installs
3
First Seen
Jun 16, 2026
testing-patterns-nodejs — couchbaselabs/agent-skills