Evaluation engine for mock and expectation rules.
It is responsible for:
- matching incoming commands against configured rules
- supporting sequence responses (lists) and callback functions
- tracking usage counts for expectations
- returning a concrete response specification for the connection layer
Summary
Functions
Applies mock/expectation rules according to the given mode.
Types
@type result() :: %{ response: term(), rule_id: reference() | nil, rules: [FauxRedis.MockRule.t()] }
Result of rule evaluation.
Functions
@spec apply( [FauxRedis.MockRule.t()], FauxRedis.Command.t(), :mock_first | :mock_only | :stateful_only, (-> term()) ) :: result()
Applies mock/expectation rules according to the given mode.
Modes:
:mock_first– try rules, fall back tofallback.()when no match:mock_only– try rules, return{:error, "ERR unknown command"}when no match:stateful_only– ignore rules, always callfallback.()