testing library

Test helpers for Bifrost unit, integration, and widget tests.

Import in tests:

import 'package:bifrosted/testing.dart';

Classes

BifrostInternalDiagnostic
A programming defect contained at a repository boundary.
BifrostInternalDiagnosticRecorder
Records repository-contained programming defects for test assertions.
BifrostNotification
A user-facing failure notification emitted by BifrostRepository.
BifrostNotificationRecorder
Records user-facing repository notifications without replacing the app's SystemNotifier registration.
BifrostTestRuntime
Installs and resets only Bifrost's process-wide runtime test seams.

Enums

TestDeviceDimensions
Device dimensions for golden tests.

Extensions

BifrostWidgetTester on WidgetTester
Widget/golden test pumping at device sizes.

Constants

kDefaultGoldenDevices → const List<TestDeviceDimensions>
Devices commonly used for multi-screen golden tests.

Properties

bifrostMockResponder MockResponder?
The responder every mocked request consults, read per request.
getter/setter pair
testAppBuilder TestAppBuilder?
App root factory used by BifrostWidgetTester.pumpApp.
getter/setter pair

Functions

configureTesterForSize(WidgetTester tester, Size canvasSize, double devicePixelRatio) Future<void>
Configures the test surface size for golden tests.
jsonResponse(Object? body, {int status = 200, Map<String, String>? headers}) → Response
A JSON response, encoded with the header a client will look for.
postgrestErrorResponse({required int status, required String message, String? code, String? details, String? hint}) → Response
Builds a PostgREST-shaped HTTP error for end-to-end adapter tests.
useMockClient({bool shouldFail = false, int failStatusCode = 400, Object? responseFactory(Request request)?, MockResponder? responder}) → void
Configure all RestAPI instances to use an in-memory mock client.
useMockStorage({Map<String, Object> values = const <String, Object>{}}) → void
Installs an in-memory SharedPreferences store for tests.

Typedefs

BifrostNotificationObserver = void Function(BifrostNotification notification)
MockResponder = FutureOr<Response> Function(Request request)
Builds the response a mocked request resolves to.
TestAppBuilder = Widget Function({Widget? home, Locale? locale, String? route})
Builds the app root widget for widget/golden tests.