Skip to content

Commit a54d60d

Browse files
authored
Update dev deps (#1158)
1 parent 5112c69 commit a54d60d

13 files changed

+104
-85
lines changed

dart/example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ dependencies:
1212
path: ../../dart
1313

1414
dev_dependencies:
15-
lints: ^1.0.1
15+
lints: ^2.0.0

dart/example_web/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
path: ../../dart
1212

1313
dev_dependencies:
14-
build_runner: ^2.1.7
14+
build_runner: ^2.1.8
1515
build_web_compilers: ^3.2.2
16-
lints: ^1.0.1
16+
lints: ^2.0.0
1717
webdev: ^2.7.6

dio/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ dev_dependencies:
1818
test: ^1.21.1
1919
coverage: ^1.3.0
2020
mockito: ^5.1.0
21-
http: ^0.13.4

dio/test/mocks/mock_http_client_adapter.dart

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ typedef MockFetchMethod = Future<ResponseBody> Function(
1010
Future<dynamic>? cancelFuture,
1111
);
1212

13+
typedef MockCloseMethod = void Function({bool force});
14+
1315
class MockHttpClientAdapter extends HttpClientAdapter
1416
with NoSuchMethodProvider {
15-
MockHttpClientAdapter(this.mockFetchMethod);
17+
MockHttpClientAdapter(this.mockFetchMethod, {this.mockCloseMethod});
1618

1719
final MockFetchMethod mockFetchMethod;
20+
final MockCloseMethod? mockCloseMethod;
1821

1922
@override
2023
Future<ResponseBody> fetch(
@@ -24,4 +27,9 @@ class MockHttpClientAdapter extends HttpClientAdapter
2427
) {
2528
return mockFetchMethod(options, requestStream, cancelFuture);
2629
}
30+
31+
@override
32+
void close({bool force = false}) {
33+
return mockCloseMethod?.call(force: force);
34+
}
2735
}

dio/test/sentry_dio_client_adapter_test.dart

+21-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import 'package:dio/dio.dart';
2-
import 'package:http/http.dart';
3-
import 'package:mockito/mockito.dart';
42
import 'package:sentry/sentry.dart';
53
import 'package:sentry_dio/src/sentry_dio_client_adapter.dart';
64
import 'package:test/test.dart';
@@ -47,16 +45,10 @@ void main() {
4745
});
4846

4947
test('close does get called for user defined client', () async {
50-
final mockHub = MockHub();
48+
final client = createCloseClient();
49+
final sut = fixture.getSut(client: client);
5150

52-
final mockClient = CloseableMockClient();
53-
54-
final client = SentryHttpClient(client: mockClient, hub: mockHub);
55-
client.close();
56-
57-
expect(mockHub.addBreadcrumbCalls.length, 0);
58-
expect(mockHub.captureExceptionCalls.length, 0);
59-
verify(mockClient.close());
51+
sut.close(force: true);
6052
});
6153

6254
test('no captured span if tracing disabled', () async {
@@ -96,7 +88,18 @@ MockHttpClientAdapter createThrowingClient() {
9688
);
9789
}
9890

99-
class CloseableMockClient extends Mock implements BaseClient {}
91+
void _close({bool force = false}) {
92+
expect(force, true);
93+
}
94+
95+
MockHttpClientAdapter createCloseClient() {
96+
return MockHttpClientAdapter(
97+
(_, __, ___) async {
98+
return ResponseBody.fromString('', 200);
99+
},
100+
mockCloseMethod: _close,
101+
);
102+
}
100103

101104
class Fixture {
102105
Dio getSut({
@@ -121,10 +124,12 @@ class Fixture {
121124
final MockHub hub = MockHub();
122125

123126
MockHttpClientAdapter getClient({int statusCode = 200, String? reason}) {
124-
return MockHttpClientAdapter((options, _, __) async {
125-
expect(options.uri, requestUri);
126-
return ResponseBody.fromString('', statusCode);
127-
});
127+
return MockHttpClientAdapter(
128+
(options, _, __) async {
129+
expect(options.uri, requestUri);
130+
return ResponseBody.fromString('', statusCode);
131+
},
132+
);
128133
}
129134
}
130135

dio/test/tracing_client_adapter_test.dart

-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The lint above is okay, because we're using another Sentry package
33

44
import 'package:dio/dio.dart';
5-
import 'package:http/http.dart';
6-
import 'package:mockito/mockito.dart';
75
import 'package:sentry/sentry.dart';
86
import 'package:sentry/src/sentry_tracer.dart';
97
import 'package:sentry_dio/src/tracing_client_adapter.dart';
@@ -153,8 +151,6 @@ MockHttpClientAdapter createThrowingClient() {
153151
);
154152
}
155153

156-
class CloseableMockClient extends Mock implements BaseClient {}
157-
158154
class Fixture {
159155
final _options = SentryOptions(dsn: fakeDsn);
160156
late Hub _hub;

e2e_test/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
sentry:
1212
path:
1313
./../dart
14-
http: ^0.13.3
14+
http: ^0.13.0
1515

1616
dev_dependencies:
17-
lints: ^1.0.1
17+
lints: ^2.0.0

flutter/example/analysis_options.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: package:pedantic/analysis_options.yaml
1+
include: package:flutter_lints/flutter.yaml
22

33
analyzer:
44
errors:

flutter/example/integration_test/integration_test.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() {
1313
await tester.pumpWidget(SentryScreenshotWidget(
1414
child: DefaultAssetBundle(
1515
bundle: SentryAssetBundle(enableStructuredDataTracing: true),
16-
child: MyApp(),
16+
child: const MyApp(),
1717
)));
1818
await tester.pumpAndSettle();
1919
});
@@ -34,20 +34,20 @@ void main() {
3434
final event = SentryEvent();
3535
final sentryId = await Sentry.captureEvent(event);
3636

37-
expect(sentryId != SentryId.empty(), true);
37+
expect(sentryId != const SentryId.empty(), true);
3838
});
3939

4040
testWidgets('setup sentry and capture exception', (tester) async {
4141
await setupSentryAndApp(tester);
4242

4343
try {
44-
throw SentryException(
44+
throw const SentryException(
4545
type: 'StarError', value: 'I have a bad feeling about this...');
4646
} catch (exception, stacktrace) {
4747
final sentryId =
4848
await Sentry.captureException(exception, stackTrace: stacktrace);
4949

50-
expect(sentryId != SentryId.empty(), true);
50+
expect(sentryId != const SentryId.empty(), true);
5151
}
5252
});
5353

@@ -56,7 +56,7 @@ void main() {
5656

5757
final sentryId = await Sentry.captureMessage('hello world!');
5858

59-
expect(sentryId != SentryId.empty(), true);
59+
expect(sentryId != const SentryId.empty(), true);
6060
});
6161

6262
testWidgets('setup sentry and capture user feedback', (tester) async {

0 commit comments

Comments
 (0)