testing library

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

Import in tests:

import 'package:bifrosted/testing.dart';

Classes

BifrostTestEnv
Shared Bifrost test dependencies and service locator wiring.
MockAnalyticsService
Records AnalyticsService calls for assertions.
MockAttributionService
Configurable AttributionService. Defaults to null, matching iOS and an organic Android install.
MockConnectionChecker
Configurable ConnectionChecker for online/offline test scenarios.
MockEntitlementService
Configurable EntitlementService for gating and paywall tests.
MockNotifier
Tracks SystemNotifier callbacks for assertions in tests.
MockPaywallPresenter
Records which placements were presented, and returns a scripted outcome.
MockStorage
In-memory StorageService for unit and integration tests.

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

bifrostTestEnv BifrostTestEnv
Global test environment. See BifrostTestEnv.
final
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.
useMockClient({bool shouldFail = false, int failStatusCode = 400, Object? responseFactory(Request request)?}) → 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

TestAppBuilder = Widget Function({Widget? home, Locale? locale, String? route})
Builds the app root widget for widget/golden tests.