platform/packages/route/test/chain_nest_test.dart

20 lines
527 B
Dart
Raw Normal View History

2017-03-17 17:36:04 +00:00
import 'package:angel_route/angel_route.dart';
import 'package:test/test.dart';
2021-02-21 02:47:23 +00:00
void main() {
2019-11-28 17:40:32 +00:00
var router = Router<String>()
2018-08-20 18:59:51 +00:00
..chain(['a']).group('/b', (router) {
router.chain(['c']).chain(['d']).group('/e', (router) {
2017-03-17 17:36:04 +00:00
router.get('f', 'g');
});
})
..dumpTree();
test('nested route groups with chain', () {
2021-04-03 05:50:52 +00:00
var r = router.resolveAbsolute('/b/e/f').first.route;
2017-03-17 17:36:04 +00:00
expect(r, isNotNull);
expect(r.handlers, hasLength(4));
expect(r.handlers, equals(['a', 'c', 'd', 'g']));
});
}