Files
jinzhi/test/features/mall/mall_entry_promo_store_test.dart
T

23 lines
799 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:jinzhi_flutter_app/common/storage/preferences_storage.dart';
import 'package:jinzhi_flutter_app/features/mall/application/mall_entry_promo_store.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
test('records each first-install mall promotion exposure once', () async {
SharedPreferences.setMockInitialValues(<String, Object>{});
final store = MallEntryPromoStore(
PreferencesStorage(await SharedPreferences.getInstance()),
);
expect(store.hasOpenedMall, isFalse);
expect(store.hasSeenHomeBadge, isFalse);
await store.markMallOpened();
await store.markHomeBadgeSeen();
expect(store.hasOpenedMall, isTrue);
expect(store.hasSeenHomeBadge, isTrue);
});
}