From aa4f7d4e7244d4e27baab88ad8544ec153491f1e Mon Sep 17 00:00:00 2001 From: Ricardo Amador <32242716+ricardoamador@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:59:31 -0700 Subject: [PATCH] Remove unneccessary casts. (#2930) *Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.* *List which issues are fixed by this PR. You must list at least one issue.* *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* --- app_dart/pubspec.yaml | 2 +- app_dart/test/request_handlers/github_webhook_test.dart | 4 ++-- .../test/request_handlers/query_github_graphql_test.dart | 5 ++--- app_dart/test/src/request_handling/fake_http.dart | 4 ++-- auto_submit/test/requests/github_webhook_test.dart | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app_dart/pubspec.yaml b/app_dart/pubspec.yaml index d934f8b9f..cf2b06d7c 100644 --- a/app_dart/pubspec.yaml +++ b/app_dart/pubspec.yaml @@ -8,7 +8,7 @@ homepage: https://github.com/flutter/cocoon publish_to: none environment: - sdk: '>=2.19.0-0 <4.0.0' + sdk: '>=3.0.0-0 <4.0.0' dependencies: appengine: 0.13.5 diff --git a/app_dart/test/request_handlers/github_webhook_test.dart b/app_dart/test/request_handlers/github_webhook_test.dart index 91eda4507..b508a011b 100644 --- a/app_dart/test/request_handlers/github_webhook_test.dart +++ b/app_dart/test/request_handlers/github_webhook_test.dart @@ -66,8 +66,8 @@ void main() { test('Publishes message', () async { request.headers.set('X-GitHub-Event', 'pull_request'); request.body = '{}'; - final Uint8List body = utf8.encode(request.body!) as Uint8List; - final Uint8List key = utf8.encode(keyString) as Uint8List; + final Uint8List body = utf8.encode(request.body!); + final Uint8List key = utf8.encode(keyString); final String hmac = getHmac(body, key); request.headers.set('X-Hub-Signature', 'sha1=$hmac'); await tester.post(webhook); diff --git a/app_dart/test/request_handlers/query_github_graphql_test.dart b/app_dart/test/request_handlers/query_github_graphql_test.dart index 1150bcc79..402ec34d6 100644 --- a/app_dart/test/request_handlers/query_github_graphql_test.dart +++ b/app_dart/test/request_handlers/query_github_graphql_test.dart @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:convert'; -import 'dart:typed_data'; import 'package:cocoon_service/src/request_handlers/query_github_graphql.dart'; import 'package:cocoon_service/src/request_handling/body.dart'; @@ -38,7 +37,7 @@ void main() { handler = QueryGithubGraphql( config: config, authenticationProvider: FakeAuthenticationProvider(), - requestBodyValue: utf8.encode(graphQLHelloWorld) as Uint8List, + requestBodyValue: utf8.encode(graphQLHelloWorld), ); }); @@ -46,7 +45,7 @@ void main() { handler = QueryGithubGraphql( config: config, authenticationProvider: FakeAuthenticationProvider(), - requestBodyValue: utf8.encode('') as Uint8List, + requestBodyValue: utf8.encode(''), ); expect(() => tester.post(handler), throwsA(isA())); }); diff --git a/app_dart/test/src/request_handling/fake_http.dart b/app_dart/test/src/request_handling/fake_http.dart index 372aa51cc..7dc37856c 100644 --- a/app_dart/test/src/request_handling/fake_http.dart +++ b/app_dart/test/src/request_handling/fake_http.dart @@ -21,8 +21,8 @@ class _Body { _Body.utf8(String this.value) : isUtf8 = true, - bytes = utf8.encode(value) as Uint8List, - stream = Stream.fromIterable([utf8.encode(value) as Uint8List]); + bytes = utf8.encode(value), + stream = Stream.fromIterable([utf8.encode(value)]); _Body.rawBytes(this.bytes) : isUtf8 = false, diff --git a/auto_submit/test/requests/github_webhook_test.dart b/auto_submit/test/requests/github_webhook_test.dart index f686a4ea2..96b262b05 100644 --- a/auto_submit/test/requests/github_webhook_test.dart +++ b/auto_submit/test/requests/github_webhook_test.dart @@ -36,8 +36,8 @@ void main() { }); test('call handler to handle the post request', () async { - final Uint8List body = utf8.encode(generateWebhookEvent()) as Uint8List; - final Uint8List key = utf8.encode(keyString) as Uint8List; + final Uint8List body = utf8.encode(generateWebhookEvent()); + final Uint8List key = utf8.encode(keyString); final String hmac = getHmac(body, key); validHeader = {'X-Hub-Signature': 'sha1=$hmac', 'X-GitHub-Event': 'yes'}; req = Request('POST', Uri.parse('http://localhost/'), body: generateWebhookEvent(), headers: validHeader);