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
140
pub points
17%
popularity

Publisher

unverified uploader

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