Fixed
This commit is contained in:
parent
31ff913784
commit
e8a46d5804
1 changed files with 9 additions and 6 deletions
|
@ -21,8 +21,8 @@ wireHooked(HookedService hooked) {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
group('Generic Tests', () {
|
group('Generic Tests', () {
|
||||||
Angel app = new Angel();
|
Angel app;
|
||||||
AngelHttp transport = new AngelHttp(app);
|
AngelHttp transport;
|
||||||
http.Client client;
|
http.Client client;
|
||||||
Db db = new Db('mongodb://localhost:27017/angel_mongo');
|
Db db = new Db('mongodb://localhost:27017/angel_mongo');
|
||||||
DbCollection testData;
|
DbCollection testData;
|
||||||
|
@ -30,11 +30,13 @@ main() {
|
||||||
HookedService<String, Map<String, dynamic>, MongoService> greetingService;
|
HookedService<String, Map<String, dynamic>, MongoService> greetingService;
|
||||||
|
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
|
app = new Angel();
|
||||||
|
transport = new AngelHttp(app);
|
||||||
client = new http.Client();
|
client = new http.Client();
|
||||||
await db.open();
|
await db.open();
|
||||||
testData = db.collection('test_data');
|
testData = db.collection('test_data');
|
||||||
// Delete anything before we start
|
// Delete anything before we start
|
||||||
await testData.remove({});
|
await testData.remove(<String, dynamic>{});
|
||||||
|
|
||||||
var service = new MongoService(testData, debug: true);
|
var service = new MongoService(testData, debug: true);
|
||||||
greetingService = new HookedService(service);
|
greetingService = new HookedService(service);
|
||||||
|
@ -48,7 +50,7 @@ main() {
|
||||||
|
|
||||||
tearDown(() async {
|
tearDown(() async {
|
||||||
// Delete anything left over
|
// Delete anything left over
|
||||||
await testData.remove({});
|
await testData.remove(<String, dynamic>{});
|
||||||
await db.close();
|
await db.close();
|
||||||
await transport.close();
|
await transport.close();
|
||||||
client = null;
|
client = null;
|
||||||
|
@ -63,7 +65,8 @@ main() {
|
||||||
|
|
||||||
response = await client.get("$url/api");
|
response = await client.get("$url/api");
|
||||||
expect(response.statusCode, isIn([200, 201]));
|
expect(response.statusCode, isIn([200, 201]));
|
||||||
List<Map> users = god.deserialize(response.body);
|
List<Map> users =
|
||||||
|
god.deserialize(response.body, outputType: <Map>[].runtimeType);
|
||||||
expect(users.length, equals(1));
|
expect(users.length, equals(1));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -130,7 +133,7 @@ main() {
|
||||||
|
|
||||||
var response = await client.get("$url/api?to=world");
|
var response = await client.get("$url/api?to=world");
|
||||||
print(response.body);
|
print(response.body);
|
||||||
List<Map> queried = god.deserialize(response.body);
|
List<Map> queried = god.deserialize(response.body, outputType: <Map>[].runtimeType);
|
||||||
expect(queried.length, equals(1));
|
expect(queried.length, equals(1));
|
||||||
expect(queried[0].keys.length, equals(2));
|
expect(queried[0].keys.length, equals(2));
|
||||||
expect(queried[0]["id"], equals(world["id"]));
|
expect(queried[0]["id"], equals(world["id"]));
|
||||||
|
|
Loading…
Reference in a new issue