1.1.0-alpha+1
This commit is contained in:
parent
8d3c08fb2d
commit
68a33030e5
3 changed files with 9 additions and 3 deletions
|
@ -23,7 +23,7 @@ final Uuid _uuid = new Uuid();
|
||||||
Future<TestClient> connectTo(Angel app,
|
Future<TestClient> connectTo(Angel app,
|
||||||
{Map initialSession, bool autoDecodeGzip: true}) async {
|
{Map initialSession, bool autoDecodeGzip: true}) async {
|
||||||
if (!app.isProduction)
|
if (!app.isProduction)
|
||||||
app.properties.putIfAbsent('testMode', () => true);
|
app.configuration.putIfAbsent('testMode', () => true);
|
||||||
|
|
||||||
for (var plugin in app.startupHooks)
|
for (var plugin in app.startupHooks)
|
||||||
await plugin(app);
|
await plugin(app);
|
||||||
|
@ -52,7 +52,10 @@ class TestClient extends client.BaseAngelClient {
|
||||||
|
|
||||||
TestClient(this.server, {this.autoDecodeGzip: true}) : super(new http.Client(), '/');
|
TestClient(this.server, {this.autoDecodeGzip: true}) : super(new http.Client(), '/');
|
||||||
|
|
||||||
Future close() => server.close();
|
Future close() {
|
||||||
|
this.client.close();
|
||||||
|
return server.close();
|
||||||
|
}
|
||||||
|
|
||||||
/// Opens a WebSockets connection to the server. This will automatically bind the server
|
/// Opens a WebSockets connection to the server. This will automatically bind the server
|
||||||
/// over HTTP, if it is not already listening. Unfortunately, WebSockets cannot be mocked (yet!).
|
/// over HTTP, if it is not already listening. Unfortunately, WebSockets cannot be mocked (yet!).
|
||||||
|
|
|
@ -2,7 +2,7 @@ author: "Tobe O <thosakwe@gmail.com>"
|
||||||
description: "Testing utility library for the Angel framework."
|
description: "Testing utility library for the Angel framework."
|
||||||
homepage: "https://github.com/angel-dart/test.git"
|
homepage: "https://github.com/angel-dart/test.git"
|
||||||
name: "angel_test"
|
name: "angel_test"
|
||||||
version: 1.1.0-alpha
|
version: 1.1.0-alpha+1
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_client: ^1.1.0-alpha
|
angel_client: ^1.1.0-alpha
|
||||||
angel_framework: ^1.1.0-alpha
|
angel_framework: ^1.1.0-alpha
|
||||||
|
|
|
@ -48,6 +48,8 @@ main() {
|
||||||
await app.configure(ws.configureServer);
|
await app.configure(ws.configureServer);
|
||||||
app.all('/ws', ws.handleRequest);
|
app.all('/ws', ws.handleRequest);
|
||||||
|
|
||||||
|
app.errorHandler = (e, req, res) => e.toJson();
|
||||||
|
|
||||||
client = await connectTo(app);
|
client = await connectTo(app);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,6 +73,7 @@ main() {
|
||||||
|
|
||||||
test('isAngelHttpException', () async {
|
test('isAngelHttpException', () async {
|
||||||
var res = await client.get('/error');
|
var res = await client.get('/error');
|
||||||
|
print(res.body);
|
||||||
expect(res, isAngelHttpException());
|
expect(res, isAngelHttpException());
|
||||||
expect(
|
expect(
|
||||||
res,
|
res,
|
||||||
|
|
Loading…
Reference in a new issue