mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
54 lines
1.8 KiB
Dart
54 lines
1.8 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
import 'package:immich_mobile/domain/services/store.service.dart';
|
|
import 'package:immich_mobile/presentation/actions/action.widget.dart';
|
|
import 'package:immich_mobile/presentation/actions/asset_debug.action.dart';
|
|
import 'package:immich_ui/immich_ui.dart';
|
|
|
|
import '../../factories/remote_asset_factory.dart';
|
|
import '../presentation_context.dart';
|
|
|
|
void main() {
|
|
late PresentationContext context;
|
|
|
|
setUp(() async {
|
|
context = await PresentationContext.create();
|
|
await StoreService.I.put(StoreKey.advancedTroubleshooting, true);
|
|
});
|
|
|
|
tearDown(() {
|
|
context.dispose();
|
|
});
|
|
|
|
group('AssetDebugAction', () {
|
|
testWidgets('visible for a single asset when advanced troubleshooting is on', (tester) async {
|
|
await tester.pumpTestWidget(
|
|
context,
|
|
ActionIconButtonWidget(action: AssetDebugAction(assets: [RemoteAssetFactory.create()])),
|
|
);
|
|
|
|
expect(find.byType(ImmichIconButton), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('hidden for multiple assets', (tester) async {
|
|
await tester.pumpTestWidget(
|
|
context,
|
|
ActionIconButtonWidget(
|
|
action: AssetDebugAction(assets: [RemoteAssetFactory.create(), RemoteAssetFactory.create()]),
|
|
),
|
|
);
|
|
|
|
expect(find.byType(ImmichIconButton), findsNothing);
|
|
});
|
|
|
|
testWidgets('hidden when advanced troubleshooting is off', (tester) async {
|
|
await StoreService.I.put(StoreKey.advancedTroubleshooting, false);
|
|
await tester.pumpTestWidget(
|
|
context,
|
|
ActionIconButtonWidget(action: AssetDebugAction(assets: [RemoteAssetFactory.create()])),
|
|
);
|
|
|
|
expect(find.byType(ImmichIconButton), findsNothing);
|
|
});
|
|
});
|
|
}
|