From bcac051492a43329b9ca7986cf074a7e9d3fcc2c Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 21 Oct 2018 04:22:41 -0400 Subject: [PATCH] 2.0.0-alpha.1 --- CHANGELOG.md | 3 +++ example/main.dart | 4 ++-- lib/src/client.dart | 21 +++++++++++---------- lib/src/matchers.dart | 2 +- pubspec.yaml | 5 +++-- test/simple_test.dart | 5 ++--- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f174186..9906dd3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.0.0-alpha.1 +* Update for compliance with newer `angel_client`. + # 2.0.0-alpha * Depend on Dart 2 and Angel 2. diff --git a/example/main.dart b/example/main.dart index 1252a544..1c7ac552 100644 --- a/example/main.dart +++ b/example/main.dart @@ -1,8 +1,8 @@ +import 'dart:io'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_test/angel_test.dart'; import 'package:angel_validate/angel_validate.dart'; import 'package:angel_websocket/server.dart'; -import 'package:dart2_constant/io.dart'; import 'package:test/test.dart'; main() { @@ -34,7 +34,7 @@ main() { ..get('/gzip', (req, res) async { res ..headers['content-encoding'] = 'gzip' - ..write(gzip.encode('Poop'.codeUnits)) + ..add(gzip.encode('Poop'.codeUnits)) ..close(); }) ..use( diff --git a/lib/src/client.dart b/lib/src/client.dart index 5540111f..b5dff30f 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1,8 +1,6 @@ import 'dart:async'; -import 'dart:convert' show Encoding; -import 'dart:io' show ContentType, Cookie, HttpServer, HttpSession, WebSocket; -import 'package:dart2_constant/convert.dart'; -import 'package:dart2_constant/io.dart' hide WebSocket; +import 'dart:convert'; +import 'dart:io'; import 'package:angel_client/base_angel_client.dart' as client; import 'package:angel_client/io.dart' as client; import 'package:angel_framework/angel_framework.dart'; @@ -181,22 +179,25 @@ class TestClient extends client.BaseAngelClient { } @override - Future configure(client.AngelConfigurer configurer) => configurer(this); + Future configure(client.AngelConfigurer configurer) => + new Future.sync(() => configurer(this)); @override - client.Service service(String path, - {Type type, client.AngelDeserializer deserializer}) { + client.Service service(String path, + {Type type, client.AngelDeserializer deserializer}) { String uri = path.toString().replaceAll(_straySlashes, ""); return _services.putIfAbsent( - uri, () => new _MockService(this, uri, deserializer: deserializer)); + uri, + () => new _MockService(this, uri, + deserializer: deserializer)) as client.Service; } } -class _MockService extends client.BaseAngelService { +class _MockService extends client.BaseAngelService { final TestClient _app; _MockService(this._app, String basePath, - {client.AngelDeserializer deserializer}) + {client.AngelDeserializer deserializer}) : super(null, _app, basePath, deserializer: deserializer); @override diff --git a/lib/src/matchers.dart b/lib/src/matchers.dart index fc0f62a7..7fadf2df 100644 --- a/lib/src/matchers.dart +++ b/lib/src/matchers.dart @@ -1,7 +1,7 @@ +import 'dart:convert'; import 'dart:io'; import 'package:angel_http_exception/angel_http_exception.dart'; import 'package:angel_validate/angel_validate.dart'; -import 'package:dart2_constant/convert.dart'; import 'package:http/http.dart' as http; import 'package:matcher/matcher.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 454b07b6..9a1f3448 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,12 @@ author: Tobe O -description: Testing utility library for the Angel framework. +description: Testing utility library for the Angel framework. Use with package:test. homepage: https://github.com/angel-dart/test.git name: angel_test -version: 2.0.0-alpha +version: 2.0.0-alpha.1 dependencies: angel_client: ^2.0.0-alpha angel_framework: ^2.0.0-alpha + angel_http_exception: ^1.0.0 angel_validate: ^2.0.0-alpha angel_websocket: ^2.0.0-alpha http: ^0.11.0 diff --git a/test/simple_test.dart b/test/simple_test.dart index b934c76b..09082f2e 100644 --- a/test/simple_test.dart +++ b/test/simple_test.dart @@ -1,9 +1,8 @@ -import 'dart:io' show ContentType; +import 'dart:io'; import 'package:angel_framework/angel_framework.dart'; import 'package:angel_test/angel_test.dart'; import 'package:angel_validate/angel_validate.dart'; import 'package:angel_websocket/server.dart'; -import 'package:dart2_constant/io.dart'; import 'package:test/test.dart'; main() { @@ -35,7 +34,7 @@ main() { ..get('/gzip', (req, res) async { res ..headers['content-encoding'] = 'gzip' - ..write(gzip.encode('Poop'.codeUnits)) + ..add(gzip.encode('Poop'.codeUnits)) ..close(); }) ..use(