import 'package:baron_safe_app/src/features/webview/baron_safe_webview_policy.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('BaronSafeWebViewPolicy', () { const policy = BaronSafeWebViewPolicy(); test('allows production and staging HTTPS hosts', () { expect(policy.allows(Uri.parse('https://safe.baron.hmac.kr')), isTrue); expect( policy.allows(Uri.parse('https://safe-staging.baron.hmac.kr/path')), isTrue, ); }); test('allows local HTTP development hosts', () { expect(policy.allows(Uri.parse('http://localhost:8080')), isTrue); expect(policy.allows(Uri.parse('http://127.0.0.1:8080')), isTrue); expect(policy.allows(Uri.parse('http://10.0.2.2:8080')), isTrue); }); test('blocks unknown hosts and insecure remote HTTP', () { expect(policy.allows(Uri.parse('https://example.com')), isFalse); expect(policy.allows(Uri.parse('http://safe.baron.hmac.kr')), isFalse); }); test('blocks non-web schemes and relative URLs', () { expect(policy.allows(Uri.parse('javascript:alert(1)')), isFalse); expect(policy.allows(Uri.parse('/relative/path')), isFalse); }); }); }