Skip to content

v0.5.0

Choose a tag to compare

@nicandcranny nicandcranny released this 16 Sep 10:08
· 1 commit to main since this release

Add Keyed mode

  • Simple mode — one handler per route. Perfect for a single test (or a
    sequential suite): register a handler, make the request, assert the calls.
    This is also perfect for static endpoint that always returns the same result
    in every test.
    Use RegisterHandler, GetNCalls, GetCalls, ResetCalls.
  • Keyed mode — one route, many per-request buckets. Use this when you want to
    run tests in parallel against the same route and return a different response
    for different requests
    . Each request is routed to a bucket by a key you
    derive from the request (e.g. a user id, a client id, a channel), so each
    parallel test owns its own handler and its own recorded calls with no
    cross-test interference. Use RegisterKeyedRoute + RegisterKeyedHandler,
    GetNCallsByKey, GetCallsByKey, ResetCallsByKey.
Simple mode (single test) Keyed mode (parallel-safe)
RegisterHandler RegisterKeyedRoute + RegisterKeyedHandler
GetNCalls(method, path) GetNCallsByKey(method, path, key)
GetCalls(method, path) GetCallsByKey(method, path, key)
ResetCalls() (all buckets) ResetCallsByKey(method, path, key)

Full Changelog: v0.4.0...v0.5.0