expector 0.1.4 expector: ^0.1.4 copied to clipboard
A package to write tests in a fluent manner and more easily.
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'));
});
}