Skip to content

Commit

Permalink
test screenshot integration
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Oct 25, 2022
1 parent f35689f commit 33aa55c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions flutter/test/integrations/screenshot_integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_flutter/src/integrations/screenshot_integration.dart';
import 'package:sentry_flutter/src/integrations/widgets_binding_integration.dart';
import 'package:sentry_flutter/src/screenshot/screenshot_attachment_processor.dart';

import '../mocks.mocks.dart';

/// Tests that require `WidgetsFlutterBinding.ensureInitialized();` not
/// being called at all.
void main() {
late Fixture fixture;

setUp(() {
fixture = Fixture();
});

test('screenshotIntegration creates screenshot processor', () async {
final integration = ScreenshotIntegration();

await integration(fixture.hub, fixture.options);

expect(
// ignore: invalid_use_of_internal_member
fixture.options.clientAttachmentProcessor
is ScreenshotAttachmentProcessor,
true);
});

test('screenshotIntegration close resets processor', () async {
final integration = ScreenshotIntegration();

await integration(fixture.hub, fixture.options);
await integration.close();

expect(
// ignore: invalid_use_of_internal_member
fixture.options.clientAttachmentProcessor
is ScreenshotAttachmentProcessor,
false);
});
}

class Fixture {
final hub = MockHub();
final options = SentryFlutterOptions();
}

0 comments on commit 33aa55c

Please sign in to comment.