darwin_test library

A simple test library for the darwin framework.

Classes

DummyHttpConnectionInfo
IsBound
Matcher that checks if an InjectorKey is bound.
IsNotRunning
Matcher that checks if a service is not running.
IsRunning
Matcher that checks if a service is running.
IsUnbound
Matcher that checks if an InjectorKey is not bound.
ReadResponse
ResponseBodyMatcher
ResponseBodyStringMatcher
ResponseHeaderStringMatcher
ResponseStatusMatcher

Properties

emptyGeneratedArgs ↔ DarwinSystemGeneratedArgs
getter/setter pair
emptyUserArgs ↔ DarwinSystemUserArgs
getter/setter pair

Functions

createInfantSystem({Module? appModule, List<DarwinPlugin> plugins = const [], List<ServiceDescriptor>? services}) → DarwinSystem
Creates an initialized but not fully started DarwinSystem that can be used for testing which involves manual startup logic. The appModule as well as plugins which will be used for by the DarwinSystemUserArgs can be optionally specified. The initial DarwinSystemGeneratedArgs which are passed to DarwinSystem.prepare will contain no service bindings.
expectResponse(DarwinSystem system, Matcher matcher, {required String path, Method method = Method.get, String? body, Map<String, dynamic> query = const {}, Map<String, String> headers = const {}}) → void
hasBody(String body) → Matcher
hasHeader(String key, String? value) → Matcher
hasStatus(int code) → Matcher
isBody(String body) → Matcher
isBound(InjectorKey key) → Matcher
Asserts that a key is bound in the given DarwinSystem or Injector.
isNotRunning<T>() → Matcher
Asserts that a service that is injectable by T is not running in a DarwinSystem.
isRunning<T>() → Matcher
Asserts that a service that is injectable by T is running in a DarwinSystem.
isStatus(int code) → Matcher
isUnbound(InjectorKey key) → Matcher
Asserts that a key is not bound in the given DarwinSystem or Injector.
startApplication(FutureOr<DarwinApplication> activator(), [FutureOr<void> callback(DarwinApplication)?]) Future<DarwinSystem>
startSystem(List<ServiceDescriptor> services, {Module? appModule, List<DarwinPlugin> plugins = const []}) Future<DarwinSystem>
Creates and start a general-use default DarwinSystem implementation. Must contain a list of services which will be used to create the DarwinSystemGeneratedArgs. The appModule as well as plugins used to construct the DarwinSystemUserArgs can be optionally specified.