1.0.4
This commit is contained in:
parent
6128daf5d6
commit
d173dd75fb
4 changed files with 25 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
# angel_test
|
# angel_test
|
||||||
[![version 1.0.3](https://img.shields.io/badge/pub-1.0.3-brightgreen.svg)](https://pub.dartlang.org/packages/angel_test)
|
[![version 1.0.4](https://img.shields.io/badge/pub-1.0.4-brightgreen.svg)](https://pub.dartlang.org/packages/angel_test)
|
||||||
[![build status](https://travis-ci.org/angel-dart/test.svg)](https://travis-ci.org/angel-dart/test)
|
[![build status](https://travis-ci.org/angel-dart/test.svg)](https://travis-ci.org/angel-dart/test)
|
||||||
|
|
||||||
Testing utility library for the Angel framework.
|
Testing utility library for the Angel framework.
|
||||||
|
|
|
@ -104,7 +104,9 @@ class TestClient extends client.BaseAngelClient {
|
||||||
await server.handleRequest(rq);
|
await server.handleRequest(rq);
|
||||||
|
|
||||||
var rs = rq.response;
|
var rs = rq.response;
|
||||||
session.addAll(rq.session);
|
session
|
||||||
|
..clear()
|
||||||
|
..addAll(rq.session);
|
||||||
|
|
||||||
Map<String, String> extractedHeaders = {};
|
Map<String, String> extractedHeaders = {};
|
||||||
|
|
||||||
|
@ -157,9 +159,7 @@ class TestClient extends client.BaseAngelClient {
|
||||||
{Type type, client.AngelDeserializer deserializer}) {
|
{Type type, client.AngelDeserializer deserializer}) {
|
||||||
String uri = path.toString().replaceAll(_straySlashes, "");
|
String uri = path.toString().replaceAll(_straySlashes, "");
|
||||||
return _services.putIfAbsent(
|
return _services.putIfAbsent(
|
||||||
uri,
|
uri, () => new _MockService(this, uri, deserializer: deserializer));
|
||||||
() => new _MockService(this, '$basePath/$uri',
|
|
||||||
deserializer: deserializer));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +176,8 @@ class _MockService extends client.BaseAngelService {
|
||||||
request.headers['Authorization'] = 'Bearer ${app.authToken}';
|
request.headers['Authorization'] = 'Bearer ${app.authToken}';
|
||||||
}
|
}
|
||||||
|
|
||||||
return _app.send(request.method, request.url, request.headers,
|
return _app.send(
|
||||||
request.finalize());
|
request.method, request.url, request.headers, request.finalize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.0.3"
|
version: "1.0.4"
|
||||||
dependencies:
|
dependencies:
|
||||||
angel_client: "^1.0.0"
|
angel_client: "^1.0.0"
|
||||||
angel_framework: "^1.0.0-dev"
|
angel_framework: "^1.0.0-dev"
|
||||||
|
|
|
@ -33,6 +33,9 @@ main() {
|
||||||
..use(
|
..use(
|
||||||
'/foo',
|
'/foo',
|
||||||
new AnonymousService(
|
new AnonymousService(
|
||||||
|
index: ([params]) async => [
|
||||||
|
{'michael': 'jackson'}
|
||||||
|
],
|
||||||
create: (data, [params]) async => {'foo': 'bar'}));
|
create: (data, [params]) async => {'foo': 'bar'}));
|
||||||
|
|
||||||
var ws = new AngelWebSocket();
|
var ws = new AngelWebSocket();
|
||||||
|
@ -96,6 +99,20 @@ main() {
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
group('service', () {
|
||||||
|
test('index', () async {
|
||||||
|
var foo = client.service('foo');
|
||||||
|
var result = await foo.index();
|
||||||
|
expect(result, [{'michael': 'jackson'}]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('index', () async {
|
||||||
|
var foo = client.service('foo');
|
||||||
|
var result = await foo.create({});
|
||||||
|
expect(result, {'foo': 'bar'});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('websocket', () async {
|
test('websocket', () async {
|
||||||
var ws = await client.websocket();
|
var ws = await client.websocket();
|
||||||
var foo = ws.service('foo');
|
var foo = ws.service('foo');
|
||||||
|
|
Loading…
Reference in a new issue