TestApiProviderOverlay class

Test provider overlay: observes API calls, applies test overrides, otherwise delegates. HTTP provider that applies test mocks and delegates all other calls.

The overlay keeps the real Ensemble provider contract, so applications can exercise their normal API actions while tests replace only selected APIs.

Inheritance
  • Object
  • APIProvider
  • HTTPAPIProvider
  • TestApiProviderOverlay

Constructors

TestApiProviderOverlay({required Map<String, MockAPIResponse> mocks, HTTPAPIProvider? delegate, ApiCallRecorder? recorder, int? stepIndexProvider()?})

Properties

calls List<APICallRecord>
no setter
delegate → HTTPAPIProvider
no setter
hashCode int
The hash code for this object.
no setterinherited
hasPendingLiveCalls bool
no setter
liveAsyncRunner Future<T?> Function<T>(Future<T> ())?
getter/setter pair
recorder ApiCallRecorder
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stepIndexProvider int? Function()?
Returns the active top-level step index for attribution, if any.
getter/setter pair

Methods

bindHttpDelegate(HTTPAPIProvider delegate) → void
callCount(String apiName) int
callsFor(String apiName) List<APICallRecord>
clearApiExceptions() → void
clearMocks() → void
clone() TestApiProviderOverlay
Same instance as config — keeps call recording aligned with EnsembleTestContext.
override
dispose() → void
override
hasMock(String apiName) bool
init(String appId, Map<String, dynamic> config) Future<void>
override
invokeApi(BuildContext context, YamlMap api, DataContext eContext, String apiName) Future<HttpResponse>
override
invokeApiWithDelegate(APIProvider delegate, BuildContext context, YamlMap api, DataContext eContext, String apiName) Future<Response>
invokeMockAPI(DataContext eContext, dynamic mock) Future<HttpResponse>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetCalls() → void
setApiException(String apiName, Exception error) → void
setMock(String apiName, MockAPIResponse response) → void
toString() String
A string representation of this object.
inherited
waitForLiveCalls() Future<void>

Operators

operator ==(Object other) bool
The equality operator.
inherited