On this page:
Mocks
8.12

Mocks🔗ℹ

 (require mock) package: mock

This library includes functions and forms for working with mocks. A mock is a "fake" function used in place of the real thing during testing to simplify the test and ensure only a single unit and not it’s complex dependencies is being tested. Mocks record all arguments they’re called with and results they return for tests to inspect and verify. Mocks are most useful for testing code that calls procedures with side effects like mutation and IO.

source code: https://github.com/jackfirth/racket-mock

For integration with rackunit, see the mock/rackunit module in the mock-rackunit package.

    1 The Mock Guide

      1.1 Introduction to Mocks

      1.2 Using Mocks in Place of Dependencies

      1.3 Dynamically Changing Mock Behavior

      1.4 Automatic Mocking with Syntax

      1.5 Stubbing Undefined Dependencies

      1.6 Mocking and Opaque Values

    2 The Mock Reference

      2.1 Core Mock API

      2.2 Behavior Construction Utilities

      2.3 Mock Call Histories

      2.4 Opaque Values

      2.5 Mocking Dependencies

      2.6 Stub Implementations