testing library

What the core ships for the tests written against it.

Import this from a test, never from application code:

import 'package:dartway_serverpod_core_flutter/testing.dart';

Two kinds of thing live here, and nothing else:

  • Conformance suites. A contract whose dangerous half cannot be held by the shape of its API is held by a suite instead — the implementation runs the core's own tests and either passes them or does not.
  • Test doubles for the core's own seams. DwRecordingServerTransport stands in for the server, so a widget test can watch a feature save without a Serverpod client anywhere in the process.

They ship from here rather than from the main barrel so that nothing an application imports can reach them by accident.

Classes

DwRecordedDelete
One delete that left through the transport.
DwRecordedRead
One read that left through the transport.
DwRecordedSave
One save that left through the transport.
DwRecordingServerTransport
A DwServerTransport that answers reads from what the test prepared and keeps every write that left, for a test to assert on afterwards.
DwRepoLocalReadsFixture
One store under test, plus the three things a test cannot reach through the public contract: which queries the store agreed to keep, what it is holding, and a sign-out landing mid-flight.
DwRepoLocalWritesFixture
One store under test, plus the two things a test cannot reach through the public contract: what the queue holds, and a sign-out landing mid-flight.

Functions

dwRepoLocalReadsConformance(String description, {required Future<DwRepoLocalReadsFixture> createFixture()}) → void
The tests every DwRepoLocalReads implementation must pass.
dwRepoLocalWritesConformance(String description, {required Future<DwRepoLocalWritesFixture> createFixture()}) → void
The tests every DwRepoLocalWrites implementation must pass.

Exceptions / Errors

DwUnpreparedServerCall
Thrown when the code under test performed a server operation the test never prepared an answer for.