nc-photos/np_common/test/object_util_test.dart
2023-12-07 00:54:30 +08:00

26 lines
592 B
Dart

import 'package:np_common/object_util.dart';
import 'package:test/test.dart';
void main() {
group("ObjectExtension", () {
test("also", () {
const obj = Object();
expect(obj.also((obj) => 1), obj);
});
test("alsoFuture", () async {
const obj = Object();
expect(await obj.alsoFuture((obj) async => 1), obj);
});
test("let", () {
const obj = Object();
expect(obj.let((obj) => 1), 1);
});
test("letFuture", () async {
const obj = Object();
expect(await obj.letFuture((obj) => Future.value(1)), 1);
});
});
}