test_helper library

TestHelper for diene_problems — dependency-light sub-library.

Import via package:diene_problems/test_helper.dart. It is framework-free: every helper throws a plain ProblemMatcherError (an AssertionError) on mismatch, so it works from package:test, flutter_test, or any other runner without adding a test-framework dependency to a consumer's prod graph.

Ships:

Functions

aCatalogEntry({ErrorPortal portal = ErrorPortal.localError, required String id, String version = 'v1', String title = 'Entity not found', int status = 404, bool recoverable = false, Map<String, Object?> dataSchema = const <String, Object?>{}, List<CatalogEndpoint> endpoints = const <CatalogEndpoint>[]}) CatalogEntry
Builds a CatalogEntry whose type URI is minted by the single-source builder, so catalog fixtures stay consistent with the runtime registry.
anErrorPortal({String scheme = 'https', String host = 'docs.raichu.cluster.atomi.cloud', String landscape = 'raichu', String platform = 'dotnet', String service = 'user', String module = 'api'}) ErrorPortal
Builds an ErrorPortal for tests, defaulting to a stable, realistic shape.
aProblem({ErrorPortal portal = ErrorPortal.localError, String id = 'entity-not-found', String version = 'v1', String title = 'Entity not found', int status = 404, bool recoverable = false, String? detail, String? instance, Map<String, Object?> data = const <String, Object?>{}}) Problem
Builds a valid Problem, defaulting to a single-source type URI.
expectProblem(Object? actual, {String? type, String? title, int? status, bool? recoverable, String? detail, String? instance, Map<String, Object?>? data}) → void
Asserts the actual envelope matches the expected fields.

Exceptions / Errors

ProblemMatcherError
Thrown by expectProblem when an assertion fails.