fixed tests

This commit is contained in:
Tobe O 2018-10-22 19:10:37 -04:00
parent bcac051492
commit e3c1561f55
4 changed files with 14 additions and 8 deletions

View file

@ -1,3 +1,6 @@
# 2.0.0-alpha.2
* Explicitly import `package:angel_framework/http.dart`.
# 2.0.0-alpha.1
* Update for compliance with newer `angel_client`.

View file

@ -4,6 +4,7 @@ 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';
import 'package:angel_framework/http.dart';
import 'package:angel_websocket/io.dart' as client;
import 'package:http/http.dart' as http hide StreamedResponse;
import 'package:http/src/streamed_response.dart';

View file

@ -2,7 +2,7 @@ author: Tobe O <thosakwe@gmail.com>
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.1
version: 2.0.0-alpha.2
dependencies:
angel_client: ^2.0.0-alpha
angel_framework: ^2.0.0-alpha

View file

@ -39,11 +39,12 @@ main() {
})
..use(
'/foo',
new AnonymousService(
new AnonymousService<String, Map<String, dynamic>>(
index: ([params]) async => [
{'michael': 'jackson'}
<String, dynamic>{'michael': 'jackson'}
],
create: (data, [params]) async => {'foo': 'bar'}));
create: (data, [params]) async =>
<String, dynamic>{'foo': 'bar'}));
var ws = new AngelWebSocket(app);
await app.configure(ws.configureServer);
@ -123,23 +124,24 @@ main() {
var foo = client.service('foo');
var result = await foo.index();
expect(result, [
{'michael': 'jackson'}
<String, dynamic>{'michael': 'jackson'}
]);
});
test('index', () async {
var foo = client.service('foo');
var result = await foo.create({});
expect(result, {'foo': 'bar'});
expect(result, <String, dynamic>{'foo': 'bar'});
});
});
test('websocket', () async {
var ws = await client.websocket();
var foo = ws.service('foo');
foo.create({});
foo.create(<String, dynamic>{});
var result = await foo.onCreated.first;
expect(result is Map ? result : result.data, equals({'foo': 'bar'}));
expect(result is Map ? result : result.data,
equals(<String, dynamic>{'foo': 'bar'}));
});
});
}