expector 0.1.4 copy "expector: ^0.1.4" to clipboard
expector: ^0.1.4 copied to clipboard

A package to write tests in a fluent manner and more easily.

example/expector_example.dart

import 'package:expector/expector.dart';
import 'package:test/test.dart';

String? f() => 'hello';
String? g() => throw StateError('bad');

void main() {
  test('f() returns a 5-length string', () {
    expectThat(f()).isNotNull
      ..isNotEmpty
      ..hasLength(5);
  });
  test('g() throws a StateError', () async {
    (await expectThat(g).throws)
        .isA<StateError>()
        .satisfies((error) => error.message.contains('bad'));
  });
}
4
likes
160
points
106
downloads

Publisher

unverified uploader

Weekly Downloads

A package to write tests in a fluent manner and more easily.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

meta, test

More

Packages that depend on expector