21 lines
709 B
Dart
21 lines
709 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mileograph_flutter/ui/app_shell.dart';
|
|
|
|
void main() {
|
|
test('tabIndexForPath maps nested routes', () {
|
|
expect(tabIndexForPath('/'), 0);
|
|
expect(tabIndexForPath('/calculator'), 1);
|
|
expect(tabIndexForPath('/calculator/details'), 1);
|
|
expect(tabIndexForPath('/legs'), 2);
|
|
expect(tabIndexForPath('/traction/12/timeline'), 3);
|
|
expect(tabIndexForPath('/trips'), 4);
|
|
expect(tabIndexForPath('/add'), 5);
|
|
});
|
|
|
|
test('tabIndexForPath ignores query when parsing uri', () {
|
|
expect(tabIndexForPath(Uri.parse('/trips?sort=desc').path), 4);
|
|
expect(tabIndexForPath(Uri.parse('/calculator/details?x=1').path), 1);
|
|
});
|
|
}
|
|
|