(schema: { files: FilesSchema, fields?: FieldsSchema }, actual: Actual)
| 47 | // Note: Unfortunatly, in order to have a multipart request object, |
| 48 | // we need to create an Express server to test the hook. |
| 49 | function createAppWithHook(schema: { files: FilesSchema, fields?: FieldsSchema }, actual: Actual): Promise<any> { |
| 50 | @ParseAndValidateFiles(schema.files, schema.fields) |
| 51 | class AppController { |
| 52 | @Post('/') |
| 53 | index(ctx: Context) { |
| 54 | actual.body = ctx.request.body; |
| 55 | actual.files = ctx.files; |
| 56 | return new HttpResponseOK(); |
| 57 | } |
| 58 | } |
| 59 | return createApp(AppController); |
| 60 | } |
| 61 | |
| 62 | it('should return an HttpResponseBadRequest if the request is not of type multipart/form-data.', async () => { |
| 63 | const app = await createAppWithHook({ |
no test coverage detected