feat: enforce hierarchical back navigation and home-only exit

This commit is contained in:
qzl
2026-03-20 15:20:29 +08:00
parent 19a2cd451d
commit cbbed29a75
7 changed files with 31 additions and 11 deletions
@@ -3,6 +3,15 @@ import 'package:social_app/features/home/ui/navigation/home_return_policy.dart';
void main() {
group('resolveHomeReturnAction', () {
test('second-level pages should return to home instead of exiting app', () {
final action = resolveHomeReturnAction(
canPop: false,
isAuthEntry: false,
forceGoHome: true,
);
expect(action, HomeReturnAction.goHome);
});
test('business route with back stack prefers pop', () {
final action = resolveHomeReturnAction(canPop: true, isAuthEntry: false);
expect(action, HomeReturnAction.pop);