46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jinzhi_flutter_app/common/privacy/privacy_gate.dart';
|
|
|
|
void main() {
|
|
group('requiresAndroidPrivacyConsent', () {
|
|
test('requires consent only for an Android native app without consent', () {
|
|
expect(
|
|
requiresAndroidPrivacyConsent(
|
|
isWeb: false,
|
|
platform: TargetPlatform.android,
|
|
privacyAgreed: false,
|
|
),
|
|
isTrue,
|
|
);
|
|
});
|
|
|
|
test('does not block Android after consent or non-Android targets', () {
|
|
expect(
|
|
requiresAndroidPrivacyConsent(
|
|
isWeb: false,
|
|
platform: TargetPlatform.android,
|
|
privacyAgreed: true,
|
|
),
|
|
isFalse,
|
|
);
|
|
expect(
|
|
requiresAndroidPrivacyConsent(
|
|
isWeb: false,
|
|
platform: TargetPlatform.iOS,
|
|
privacyAgreed: false,
|
|
),
|
|
isFalse,
|
|
);
|
|
expect(
|
|
requiresAndroidPrivacyConsent(
|
|
isWeb: true,
|
|
platform: TargetPlatform.android,
|
|
privacyAgreed: false,
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
});
|
|
}
|