testing library
Conformance suites and test doubles for packages that implement a Winche service.
Core guarantees sequencing — that hooks are awaited, ordered and isolated. It cannot guarantee that an implementation actually swaps when told to, or that an auth backend reports a dropped connection as a failure rather than a sign-out. Those behaviours are what make every Winche service interchangeable, and this library is what turns them from documentation into a test.
Deliberately free of any test-framework dependency: a suite returns a
WincheContractReport rather than calling expect itself, so winche_core
stays a meta-only package and you assert with whatever framework you use.
import 'package:test/test.dart';
import 'package:winche_core/testing.dart';
test('honours the service contract', () async {
final report = await WincheServiceContract.check(create: MyDatabase.new);
expect(report.isSuccess, isTrue, reason: report.toString());
});
Classes
- ScriptedAuthService
- A WincheAuthService driven directly by a test rather than a backend.
- WincheAuthContract
- Drives a WincheAuthService implementation and reports whether it honours the two behavioural rules core depends on.
- WincheContractFailure
- One contract expectation that an implementation did not meet.
- WincheContractReport
- The outcome of running a contract suite against an implementation.
- WincheServiceContract
- Drives a WincheService implementation through the full identity lifecycle and reports whether it honours the contract core relies on.