Drives a WincheAuthService implementation and reports whether it honours the two behavioural rules core depends on.
Both rules are unexpressible in the type system, and getting either wrong is quiet and expensive:
notifyIdentityChanged(null)means an authoritative sign-out. An implementation that announces it on a transient refresh failure tears down every session on the device on a flaky connection.getAuthToken()throws when a token cannot currently be obtained, and returns null only when genuinely signed out. Reporting a network blip as "signed out" has the same effect.
test('WincheAuth honours the auth contract', () async {
final report = await WincheAuthContract.check(
create: (app) => WincheAuth(app, backend: FakeBackend()),
signIn: (auth) => (auth as WincheAuth).signInWithPassword('a@b.c', 'pw'),
signOut: (auth) => (auth as WincheAuth).signOut(),
induceTransientTokenFailure: (auth) async =>
(auth as WincheAuth).backend.failNextRefresh(),
);
expect(report.isSuccess, isTrue, reason: report.toString());
});
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
check(
{required WincheAuthService create(WincheApp app), required Future< void> signIn(WincheAuthService auth), required Future<void> signOut(WincheAuthService auth), Future<void> induceTransientTokenFailure(WincheAuthService auth)?, WincheOptions? options}) → Future<WincheContractReport> -
Runs every check against an auth service built by
create.