Files
jinzhi/test/features/web/web_page_test.dart

16 lines
549 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:jinzhi_flutter_app/features/web/presentation/web_page.dart';
void main() {
test('accepts HTTPS and rejects unsafe or remote HTTP URLs', () {
expect(
parseSafeWebUri('https://h5.example.com/page')?.host,
'h5.example.com',
);
expect(parseSafeWebUri('mailto:test@example.com'), isNull);
expect(parseSafeWebUri('javascript:alert(1)'), isNull);
expect(parseSafeWebUri('http://example.com/page'), isNull);
expect(parseSafeWebUri(''), isNull);
});
}