platform/angel_container/test/lazy_test.dart

19 lines
402 B
Dart
Raw Normal View History

2018-10-22 15:45:11 +00:00
import 'package:angel_container/angel_container.dart';
import 'package:test/test.dart';
void main() {
test('returns the same instance', () {
2019-10-12 13:34:15 +00:00
var container = Container(const EmptyReflector())
..registerLazySingleton<Dummy>((_) => Dummy('a'));
2018-10-22 15:45:11 +00:00
var first = container.make<Dummy>();
expect(container.make<Dummy>(), first);
});
}
class Dummy {
final String s;
Dummy(this.s);
}