Skip to content

Tag: nestjs

Javascript Mocking functions that return Readable

I have a simple function that calls my s3 service which will return a Promise I would like to mock the return of the object and assert it in the test like this: When i run the test, I face this error: Error [ERR_METHOD_NOT_IMPLEMENTED]: The _read() method is not implemented at Readable.read (internal/streams/…

Nested object in Joi schema

I’ve defined validation schema via Joi with nested object in AWS value: Then I put my schema to config module I’ve added inside .env file the next value for AWS variable: but I got the next error message after starting nest: typeof process.env.AWS returns a string and Joi doesn’t understand …

How @Inject(REQUEST) works and how to destructure it

The first question is how it’s possible that an injected parameter is changing after the class initialization. Because this code works and this code doesn’t work The second example doesn’t have ‘userId’ yet that should be injected by my nest.js interceptor. Why it’s like th…