From 00e861adbc9058e19639726728f918eb8e64e252 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 22 Nov 2019 08:27:46 -0500 Subject: [PATCH] Fix controller_test to await async call --- test/controller_test.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/controller_test.dart b/test/controller_test.dart index 0e0a5f3f..d5689c72 100644 --- a/test/controller_test.dart +++ b/test/controller_test.dart @@ -71,7 +71,7 @@ bool bar(RequestContext req, ResponseContext res) { main() { Angel app; - TodoController ctrl; + TodoController todoController; NoExposeController noExposeCtrl; HttpServer server; http.Client client = http.Client(); @@ -86,7 +86,7 @@ main() { // Register as a singleton, just for the purpose of this test if (!app.container.has()) { - app.container.registerSingleton(ctrl = TodoController()); + app.container.registerSingleton(todoController = TodoController()); } // Using mountController(); @@ -94,12 +94,12 @@ main() { noExposeCtrl = await app.mountController(); - // Place controller in group... - app.group('/ctrl_group', (router) { - app.container - .make() - .applyRoutes(router, app.container.reflector); - }); + // Place controller in group. The applyRoutes() call, however, is async. + // Until https://github.com/angel-dart/route/issues/28 is closed, + // this will need to be done by manually mounting the router. + var subRouter = Router(); + await todoController.applyRoutes(subRouter, app.container.reflector); + app.mount('/ctrl_group', subRouter); print(app.controllers); app.dumpTree(); @@ -115,7 +115,7 @@ main() { }); test('basic', () { - expect(ctrl.app, app); + expect(todoController.app, app); }); test('create dynamic handler', () async {