Fix controller_test to await async call
This commit is contained in:
parent
a39b33549b
commit
00e861adbc
1 changed files with 9 additions and 9 deletions
|
@ -71,7 +71,7 @@ bool bar(RequestContext req, ResponseContext res) {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
Angel app;
|
Angel app;
|
||||||
TodoController ctrl;
|
TodoController todoController;
|
||||||
NoExposeController noExposeCtrl;
|
NoExposeController noExposeCtrl;
|
||||||
HttpServer server;
|
HttpServer server;
|
||||||
http.Client client = http.Client();
|
http.Client client = http.Client();
|
||||||
|
@ -86,7 +86,7 @@ main() {
|
||||||
|
|
||||||
// Register as a singleton, just for the purpose of this test
|
// Register as a singleton, just for the purpose of this test
|
||||||
if (!app.container.has<TodoController>()) {
|
if (!app.container.has<TodoController>()) {
|
||||||
app.container.registerSingleton(ctrl = TodoController());
|
app.container.registerSingleton(todoController = TodoController());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using mountController<T>();
|
// Using mountController<T>();
|
||||||
|
@ -94,12 +94,12 @@ main() {
|
||||||
|
|
||||||
noExposeCtrl = await app.mountController<NoExposeController>();
|
noExposeCtrl = await app.mountController<NoExposeController>();
|
||||||
|
|
||||||
// Place controller in group...
|
// Place controller in group. The applyRoutes() call, however, is async.
|
||||||
app.group('/ctrl_group', (router) {
|
// Until https://github.com/angel-dart/route/issues/28 is closed,
|
||||||
app.container
|
// this will need to be done by manually mounting the router.
|
||||||
.make<TodoController>()
|
var subRouter = Router<RequestHandler>();
|
||||||
.applyRoutes(router, app.container.reflector);
|
await todoController.applyRoutes(subRouter, app.container.reflector);
|
||||||
});
|
app.mount('/ctrl_group', subRouter);
|
||||||
|
|
||||||
print(app.controllers);
|
print(app.controllers);
|
||||||
app.dumpTree();
|
app.dumpTree();
|
||||||
|
@ -115,7 +115,7 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('basic', () {
|
test('basic', () {
|
||||||
expect(ctrl.app, app);
|
expect(todoController.app, app);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('create dynamic handler', () async {
|
test('create dynamic handler', () async {
|
||||||
|
|
Loading…
Reference in a new issue