Closed bryanmytko closed 4 years ago
Notice that FileInterceptor
is a class, while FileInterceptor('file', multerAudioConfig)
returns a mixin class. FileInterceptor
!== returned mixin. To override a mixin, store it as a variable:
export const AudioFileInterceptor = FileInterceptor('file', multerAudioConfig);
And then, use AudioFileInterceptor
in your e2e tests.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Bug Report
Current behavior
I have an endpoint that accepts an uploaded file. This is handled via the
FileInterceptor
, passing s3 credentials to multer. Everything works fine when testing the endpoint via Postman.I'm trying to test this endpoint in an e2e test, but since I don't want to be uploading files to s3 every time I run the tests, especially on CI, I'm trying to circumvent the
FileInterceptor
and just throw a dummy object to the logic that handles the uploaded file.I'm using
overrideInterceptor
in my test, but it seems to do nothing. The interceptor is still being hit and the error thrown is related to S3 access, which is only expected without the override, since I don't have AWS credentials set up for the test environment.Input Code
guides.controller.ts
guides.e2e-spec.ts
Expected behavior
I'm expecting the interceptor to be overridden with my defined object.
Environment