testing library

Test matchers for Result and Option types.

Import this library in your test files to use fluent matchers:

import 'package:light_result/light_result.dart';
import 'package:light_result/testing.dart';
import 'package:test/test.dart';

void main() {
  test('returns Success', () {
    expect(fetchUser(1), isSuccess);
    expect(fetchUser(1), isSuccessWith(expectedUser));
  });
}

Constants

isFailure → const Matcher
A matcher that verifies a Result is Failure.
isNone → const Matcher
A matcher that verifies an Option is None.
isSome → const Matcher
A matcher that verifies an Option is Some.
isSuccess → const Matcher
A matcher that verifies a Result is Success.

Functions

isFailureWith(Object? value) → Matcher
A matcher that verifies a Result is Failure containing value.
isSomeWith(Object? value) → Matcher
A matcher that verifies an Option is Some containing value.
isSuccessWith(Object? value) → Matcher
A matcher that verifies a Result is Success containing value.