platform/packages/route/test/chain_nest_test.dart
thomashii@dukefirehawk.com 7c37497860 Publish angel3_route
2021-05-14 15:02:50 +08:00

19 lines
529 B
Dart

import 'package:angel3_route/angel3_route.dart';
import 'package:test/test.dart';
void main() {
var router = Router<String>()
..chain(['a']).group('/b', (router) {
router.chain(['c']).chain(['d']).group('/e', (router) {
router.get('f', 'g');
});
})
..dumpTree();
test('nested route groups with chain', () {
var r = router.resolveAbsolute('/b/e/f').first.route;
expect(r, isNotNull);
expect(r.handlers, hasLength(4));
expect(r.handlers, equals(['a', 'c', 'd', 'g']));
});
}