@@ -82,6 +82,27 @@ void main() {
8282 expect (book.chapters ().first.name, '/' );
8383 });
8484
85+ test ('parseRouteInformation calls selectBook with correct arguments' ,
86+ () async {
87+ final routeMock = ParallelRouteMock ();
88+ final params = {'param' : 'value' };
89+ final uri = Uri .parse ('/test' );
90+ when (() => routeMock.uri).thenReturn (uri);
91+ when (() => routeMock.parent).thenReturn ('' );
92+ when (() => routeMock.middlewares).thenReturn ([]);
93+ when (() => getRoute.call (any ()))
94+ .thenAnswer ((_) async => Success (routeMock));
95+ when (() => getArguments.call ())
96+ .thenReturn (Success (ModularArguments (uri: uri, data: params)));
97+ when (() => reportPush (routeMock)).thenReturn (const Success (unit));
98+
99+ const routeInformation = RouteInformation (location: '/test?param=value' );
100+ final book = await parser.parseRouteInformation (routeInformation);
101+
102+ expect (book.uri.toString (), '/test' );
103+ expect (parser.getArguments.call ().getOrNull ()? .data, params);
104+ });
105+
85106 test ('selectBook with parents' , () async {
86107 final routeMock = ParallelRouteMock ();
87108 when (() => routeMock.uri).thenReturn (Uri .parse ('/test' ));
0 commit comments