Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
fix: fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed May 3, 2020
1 parent fd99384 commit 81fc9d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/faas/src/starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class FaaSStarter implements IFaaSStarter {
const mw: any[] = await this.formatMiddlewares(fnMiddlewere);
mw.push(async (ctx) => {
// invoke handler
const result = this.invokeHandler(funOptions, ctx, args);
const result = await this.invokeHandler(funOptions, ctx, args);
if (!ctx.body) {
ctx.body = result;
}
Expand Down
15 changes: 7 additions & 8 deletions packages/serverless-fc-starter/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,13 @@ describe('/test/index.test.ts', () => {
throw new Error('oops');
})(...args);
});
let err;
try {
await test(handle).runHttp('', '');
} catch (ex) {
err = ex;
}
assert.ok(err);
assert.equal(err.message, 'oops');
const result = await test(handle).runHttp('', '');
assert.deepStrictEqual(result, {
isBase64Encoded: false,
statusCode: 500,
headers: {},
body: 'Internal Server Error',
});
});

it('should ok with non-async function', async () => {
Expand Down

0 comments on commit 81fc9d6

Please sign in to comment.