unit-testing

Creates nock-based unit tests for Node.js HTTP interactions without credentials.

6|Updated Feb 20, 2025
One-click install
npx skills add https://github.com/zerobias-org/module --skill unit-testing-zerobias-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-testing
Source: https://github.com/zerobias-org/module/tree/main/.claude/skills/unit-testing
Command: npx skills add https://github.com/zerobias-org/module --skill unit-testing-zerobias-org

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unit tests patterns using nock for HTTP mocking without credentials.

Core Features & Use Cases

  • Deterministic HTTP mocks with nock to isolate tests
  • No credentials or real network calls required for unit tests
  • Standard test structure templates for connections, producers, and mappers

Quick Start

Run the unit tests with the mocked HTTP setup and Common.ts helpers to validate your module without credentials.

Frequently Asked Questions about unit-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock HTTP requests in Node.js unit tests without using real credentials?

You can mock HTTP requests in Node.js unit tests without credentials by using nock to intercept network calls at the HTTP level. This allows tests to run deterministically without real network calls or environment variables.

What is the standard unit test structure for testing Node.js HTTP connections and producers?

The standard unit test structure for testing HTTP connections and producers involves organizing tests into Common.ts, ConnectionTest.ts, and ProducerTest.ts patterns. These templates isolate HTTP interactions using nock mocks.

Can I use chai with nock for HTTP mocking in TypeScript projects?

Yes, you can use chai with nock for HTTP mocking in TypeScript projects. The setup provides fully mocked unit testing environments for Node.js applications, ensuring deterministic HTTP mocks without real network calls.

What's the best way to isolate unit tests for Node.js modules that communicate over HTTP?

The best way to isolate unit tests for Node.js modules communicating over HTTP is using nock to intercept and mock HTTP interactions. This approach requires no credentials and enforces a strict test structure with Common.ts helpers.

Do I need to set environment variables to run unit tests with nock HTTP mocks?

No, you do not need to set environment variables to run unit tests with nock HTTP mocks. The testing setup explicitly enforces no environment variables, relying entirely on HTTP-level mocks for isolated testing.