Skip to content

Commit 8243b86

Browse files
committed
Update
1 parent a60b98b commit 8243b86

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

flutter/test/sentry_native_channel_test.dart

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,20 +243,35 @@ void main() {
243243
}));
244244
});
245245

246-
test('captureEnvelope', () async {
247-
final data = Uint8List.fromList([1, 2, 3]);
248-
249-
late Uint8List captured;
250-
when(channel.invokeMethod('captureEnvelope', any)).thenAnswer(
251-
(invocation) async =>
252-
{captured = invocation.positionalArguments[1][0] as Uint8List});
246+
test(
247+
'captureEnvelope',
248+
() {
249+
when(channel.invokeMethod('captureEnvelope', any))
250+
.thenAnswer((_) async => {});
251+
252+
late Matcher matcher;
253+
if (mockPlatform.isAndroid) {
254+
matcher = throwsA(predicate((e) =>
255+
e is Error &&
256+
e.toString().contains('Unable to locate the helper library')));
257+
} else if (mockPlatform.isIOS || mockPlatform.isMacOS) {
258+
if (Platform().isMacOS) {
259+
matcher = throwsA(predicate((e) =>
260+
e is Exception &&
261+
e.toString().contains('Failed to load Objective-C class')));
262+
} else {
263+
matcher = throwsA(predicate((e) =>
264+
e is ArgumentError &&
265+
e.toString().contains('Failed to lookup symbol')));
266+
}
267+
}
253268

254-
await sut.captureEnvelope(data, false);
269+
final data = Uint8List.fromList([1, 2, 3]);
270+
expect(() => sut.captureEnvelope(data, false), matcher);
255271

256-
expect(captured, data);
257-
},
258-
skip:
259-
(Platform().isAndroid || Platform().isIOS || Platform().isMacOS));
272+
verifyZeroInteractions(channel);
273+
},
274+
);
260275

261276
test('loadContexts', () async {
262277
when(channel.invokeMethod('loadContexts'))

0 commit comments

Comments
 (0)