testing library
Testing tools for the ConfigDirector Flutter SDK.
createTestClient builds a test client: the SDK's real
ConfigDirectorClient connected to an in-memory server that the test
controls. Only the connection to ConfigDirector, the telemetry, and the
app lifecycle and platform lookups are replaced; value parsing, readiness,
events, and watch streams are the production code. No network connection
is opened, no telemetry is sent, and no platform channel is used, so the
test client works under flutter test on the VM and in a browser alike.
import 'package:configdirector_flutter_client_sdk/testing.dart';
final testClient = createTestClient(values: {'new-checkout': true});
await testClient.client.initialize();
expect(testClient.client.getValue('new-checkout', false), isTrue);
testClient.setValue('new-checkout', false);
await pumpEventQueue();
expect(testClient.client.getValue('new-checkout', true), isFalse);
Classes
- TestClient
- A real ConfigDirectorClient together with the controls that decide what its in-memory server delivers.
Functions
-
createTestClient(
{Map< String, Object?> values = const {}, Duration? timeout, ConfigDirectorLogger? logger}) → TestClient -
Creates a TestClient holding a real ConfigDirectorClient that serves
valueswithout a network connection.