32 lines
988 B
Dart
32 lines
988 B
Dart
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pipelines_app/application/app_route.dart';
|
|
import 'package:pipelines_app/application/app_router.dart';
|
|
|
|
AppRouterDelegate delegate(AppRoute initial, {void Function()? onChat}) =>
|
|
AppRouterDelegate(
|
|
builder: (context, route) => const SizedBox.shrink(),
|
|
onPopToRuns: () {},
|
|
onPopToChat: onChat ?? () {},
|
|
cupertino: false,
|
|
initial: initial,
|
|
);
|
|
|
|
void main() {
|
|
test('system Back leaves one chat session for the chat list', () async {
|
|
var left = 0;
|
|
final router = delegate(AppRoute.chatSession('s1'), onChat: () => left++);
|
|
addTearDown(router.dispose);
|
|
|
|
expect(await router.popRoute(), isTrue);
|
|
expect(left, 1);
|
|
});
|
|
|
|
test('system Back on a list destination stays with the platform', () async {
|
|
final router = delegate(AppRoute.chat);
|
|
addTearDown(router.dispose);
|
|
|
|
expect(await router.popRoute(), isFalse);
|
|
});
|
|
}
|