Files
social-app/apps/test/features/chat/ui_schema_navigation_test.dart
T

30 lines
933 B
Dart
Raw Normal View History

import 'package:flutter_test/flutter_test.dart';
import 'package:social_app/features/chat/ui/navigation/ui_schema_navigation.dart';
void main() {
test('buildUiSchemaNavigationTarget merges scalar params only', () {
final target = buildUiSchemaNavigationTarget(
path: '/calendar/dayweek',
params: {
'date': '2026-03-18',
'from': 'home',
'count': 2,
'enabled': true,
'ignored': {'nested': true},
},
);
expect(
target,
'/calendar/dayweek?date=2026-03-18&from=home&count=2&enabled=true',
);
});
test('isValidInternalNavigationPath follows protocol constraints', () {
expect(isValidInternalNavigationPath('/todo/123/edit'), true);
expect(isValidInternalNavigationPath('https://evil.com'), false);
expect(isValidInternalNavigationPath('/todo/123?x=1'), false);
expect(isValidInternalNavigationPath('/todo/:id'), false);
});
}