platform/packages/container/angel_container/test/mirrors_test.dart
Tobe O 9c36a7e981 Add 'packages/container/' from commit 'a7eb96a391cced0f9b2d6a9fbaffc3483c2558eb'
git-subtree-dir: packages/container
git-subtree-mainline: dd33154af1
git-subtree-split: a7eb96a391
2020-02-15 18:22:26 -05:00

26 lines
810 B
Dart

import 'dart:async';
import 'package:angel_container/angel_container.dart';
import 'package:angel_container/mirrors.dart';
import 'package:test/test.dart';
import 'common.dart';
void main() {
testReflector(const MirrorsReflector());
test('futureOf', () {
var r = MirrorsReflector();
var fStr = r.reflectFutureOf(String);
expect(fStr.reflectedType.toString(), 'Future<String>');
// expect(fStr.reflectedType, Future<String>.value(null).runtimeType);
});
test('concrete future make', () async {
var c = Container(MirrorsReflector());
c.registerFactory<Future<String>>((_) async => 'hey');
var fStr = c.reflector.reflectFutureOf(String);
var s1 = await c.make(fStr.reflectedType);
var s2 = await c.makeAsync(String);
print([s1, s2]);
expect(s1, s2);
});
}