Skip to content

Commit

Permalink
Remove unneccessary casts. (#2930)
Browse files Browse the repository at this point in the history
*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].*
  • Loading branch information
ricardoamador authored Jul 12, 2023
1 parent 4f9d324 commit aa4f7d4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app_dart/test/request_handlers/github_webhook_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions app_dart/test/request_handlers/query_github_graphql_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -38,15 +37,15 @@ void main() {
handler = QueryGithubGraphql(
config: config,
authenticationProvider: FakeAuthenticationProvider(),
requestBodyValue: utf8.encode(graphQLHelloWorld) as Uint8List,
requestBodyValue: utf8.encode(graphQLHelloWorld),
);
});

test('Empty body raises a bad request exception', () async {
handler = QueryGithubGraphql(
config: config,
authenticationProvider: FakeAuthenticationProvider(),
requestBodyValue: utf8.encode('') as Uint8List,
requestBodyValue: utf8.encode(''),
);
expect(() => tester.post(handler), throwsA(isA<BadRequestException>()));
});
Expand Down
4 changes: 2 additions & 2 deletions app_dart/test/src/request_handling/fake_http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class _Body {

_Body.utf8(String this.value)
: isUtf8 = true,
bytes = utf8.encode(value) as Uint8List,
stream = Stream<Uint8List>.fromIterable(<Uint8List>[utf8.encode(value) as Uint8List]);
bytes = utf8.encode(value),
stream = Stream<Uint8List>.fromIterable(<Uint8List>[utf8.encode(value)]);

_Body.rawBytes(this.bytes)
: isUtf8 = false,
Expand Down
4 changes: 2 additions & 2 deletions auto_submit/test/requests/github_webhook_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <String, String>{'X-Hub-Signature': 'sha1=$hmac', 'X-GitHub-Event': 'yes'};
req = Request('POST', Uri.parse('http://localhost/'), body: generateWebhookEvent(), headers: validHeader);
Expand Down

0 comments on commit aa4f7d4

Please sign in to comment.