assertion-patterns

Transform mock-based unit tests into real output verification patterns.

8|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/QBall-Inc/the-bulwark --skill assertion-patterns-qball-inc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: assertion-patterns
Source: https://github.com/QBall-Inc/the-bulwark/tree/main/skills/assertion-patterns
Command: npx skills add https://github.com/QBall-Inc/the-bulwark --skill assertion-patterns-qball-inc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the issue of tests that pass without actually verifying the real-world behavior of the code, leading to a false sense of security.

Core Features & Use Cases

  • Mock Transformation: Converts tests that rely on mocked functions or system calls into tests that verify actual observable outcomes.
  • Prerequisite Checks: Enforces critical checks (T0) to ensure tests are not "testing nothing real" by verifying production module imports and proper function separation.
  • Use Case: Refactor existing test suites flagged by test-audit to ensure they provide meaningful confidence by testing actual output and behavior rather than just verifying that a function was called.

Quick Start

Use the assertion-patterns skill to rewrite tests that violate T1 by mocking the system under test.

Frequently Asked Questions about assertion-patterns

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

FAQPage Schema
Why do my unit tests pass but fail in production?

Unit tests that rely on mock-based assertions often pass by merely verifying that a function was called, without testing real behavior. Transforming these tests to verify actual observable outcomes ensures your code works outside the mock environment.

How do I refactor tests to verify real behavior instead of mock calls?

To refactor tests for behavior verification, replace mock call assertions with checks against actual observable outcomes. This includes validating real outputs from function calls, process spawns, file operations, HTTP requests, and database interactions.

When should I stop mocking the system under test in unit testing?

You should stop mocking the system under test when your tests violate behavior verification principles, such as T1 violations. Refactoring these tests ensures you are validating actual output and meaningful behavior rather than just confirming a function was executed.

What prerequisite checks are needed to ensure unit tests are valid?

Valid unit tests require prerequisite checks, known as T0 checks, to verify production module imports and enforce proper separation of concerns within test files. This prevents tests from "testing nothing real" and ensures meaningful confidence.

Can I test file operations and HTTP requests without mocking?

Yes, you can test file operations and HTTP requests without mocking by using assertion patterns that verify actual observable behavior. Instead of asserting a mock was called, you validate the real file contents written or the actual HTTP response received.

What is the best way to fix false positive test suites?

The best way to fix false positive test suites is to audit them for mock-based assertions and refactor those tests to verify real output. Enforcing prerequisite checks for production module imports ensures tests provide meaningful confidence in actual system behavior.