testing library

Reusable fakes for testing applications built on sync_queue.

Import this library from test code only:

import 'package:sync_queue/sync_queue.dart';
import 'package:sync_queue/testing.dart';

final transport = FakeSyncTransport();
final engine = SyncEngine(
  store: InMemorySyncStore(),
  transport: transport,
);

The fakes pair with InMemorySyncStore from the main library: FakeSyncTransport records sent operations, FakeSyncClock makes time deterministic, and FakeSyncTimerFactory lets tests fire retry timers manually.

Classes

FakeSyncClock
Mutable clock for deterministic time in tests.
FakeSyncTimer
Manually fired timer for deterministic retry scheduling in tests.
FakeSyncTimerFactory
Collects engine retry timers so tests can fire them manually.
FakeSyncTransport
In-memory transport for application tests.

Typedefs

FakeSyncTransportHandler = Future<SyncResult> Function(SyncOperation operation)
Signature for FakeSyncTransport response handlers.