reset static method

void reset({
  1. Object? responseFactory(
    1. Request request
    )?,
  2. MockResponder? responder,
  3. Map<String, Object> storageValues = const <String, Object>{},
  4. DateTime clock()?,
  5. BifrostNotificationRecorder? notifications,
  6. BifrostInternalDiagnosticRecorder? diagnostics,
  7. bool dispatchNotifications = false,
})

Restores Bifrost's runtime seams atomically for one test.

Implementation

static void reset({
  Object? Function(http.Request request)? responseFactory,
  MockResponder? responder,
  Map<String, Object> storageValues = const <String, Object>{},
  DateTime Function()? clock,
  BifrostNotificationRecorder? notifications,
  BifrostInternalDiagnosticRecorder? diagnostics,
  bool dispatchNotifications = false,
}) {
  _validateTransport(responseFactory, responder);
  notifications?.reset();
  diagnostics?.reset();
  bifrostNotificationSettings = BifrostNotificationSettings(
    observer: notifications?.call,
    dispatch: dispatchNotifications,
  );
  bifrostInternalDiagnosticSettings = BifrostInternalDiagnosticSettings(
    observer: diagnostics?.call,
  );

  bifrostClock = clock ?? DateTime.now;
  bifrostUseFakes = false;
  // `useMockClient` installs every explicit answer behind the per-request
  // seam. Clear first so an omitted fixture restores generic fake JSON.
  bifrostMockResponder = null;
  useMockClient(responseFactory: responseFactory, responder: responder);
  useMockStorage(values: storageValues);
  bifrostJsonDecode = (body) async => jsonDecode(body);
  bifrostPerformanceTracker = const NoOpPerformanceTracker();
}