gate-4a-unit-tests

Validate TypeScript unit-test suites for nock-only HTTP mocking and project standards.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures unit-test suites for services follow project standards by enforcing HTTP mocking with nock and validating test structure.

Core Features & Use Cases

  • Enforces nock-only HTTP mocking to prevent real network calls in unit tests.
  • Validates presence of test/unit structure, describe blocks, and minimum test cases.
  • Provides guidance for common.ts helpers and proper cleanup patterns to ensure test isolation.

Quick Start

Run the unit-test validation workflow against the repository to confirm conformance.

Frequently Asked Questions about gate-4a-unit-tests

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

FAQPage Schema
How do I enforce nock as the only HTTP mocking library in TypeScript unit tests?

To enforce nock-only HTTP mocking in TypeScript unit tests, validate test suites against project standards that reject forbidden libraries and require nock for network interception. This prevents real network calls during unit test execution.

What makes a valid TypeScript unit test structure for service testing?

A valid TypeScript unit test structure requires test files within a test/unit directory, properly formatted describe/it blocks, a minimum number of test cases, and Common.ts helpers to maintain consistency across the service testing workflow.

Why do my unit tests fail project gating requirements in TypeScript services?

Unit tests fail gating requirements when they lack sufficient describe blocks, miss afterEach cleanup routines, use forbidden libraries, or improperly rely on environment variables instead of mocking HTTP calls with nock.

How do I ensure test isolation when using nock for HTTP mocking in TypeScript?

Ensure test isolation with nock by implementing afterEach cleanup blocks in your TypeScript test suites. This clears mock interceptors after each test case, preventing mock state from leaking across unit tests.

Can I use environment variables in unit tests for TypeScript services?

No, you cannot use environment variables in unit tests for TypeScript services. Enforcing strict gating requirements prohibits environment variables to ensure tests remain isolated, deterministic, and fully mocked using nock.