What is the purpose of the @nestjs/testing package in NestJS?
@nestjs/testing
Provides utilities and helpers specifically designed for testing NestJS applications
Facilitates the deployment of NestJS applications to various cloud platforms
Offers tools for performance profiling and optimization of NestJS code
Enables integration with external continuous integration and delivery (CI/CD) pipelines
In JWT authentication, what does JWT stand for?
Java Web Token
JSON Web Token
Just Write Tests
JavaScript Web Token
What is a common approach to ensure data consistency when using CQRS and event-driven architecture in NestJS?
Implementing eventual consistency by updating read models asynchronously
Using two-phase commit transactions for command and event handling
Relying on the database's built-in transaction management system
Disabling caching mechanisms to guarantee real-time data consistency
How does NestJS facilitate database integration?
NestJS provides a modular structure and decorators to integrate various database solutions
NestJS prevents the use of external libraries like TypeORM or Mongoose
NestJS only supports relational databases and not NoSQL databases
NestJS automatically configures database connections without any additional code
In the context of NestJS testing, what are 'mocks' primarily used for?
Automating user interactions with the application's UI
Measuring the performance of specific code segments
Generating code coverage reports
Replacing external dependencies with controlled implementations
How do you activate a custom Guard globally in a NestJS application?
By using the @Global() decorator before the guard class definition.
@Global()
By registering the guard in the providers array of the module where it's defined.
providers
By manually adding the guard to each route handler where it's needed.
By defining the guard within the main.ts file of your application.
main.ts
Which module is essential for implementing JWT authentication in a NestJS application?
@nestjs/core
@nestjs/passport
@nestjs/jwt
@nestjs/common
What is a key advantage of using a message broker like RabbitMQ or Kafka for NestJS microservice communication?
Improved error handling and retries
Reduced need for code testing
Simplified database management
Automatic user interface generation
How can you apply a transformation interceptor to a specific method in a controller in NestJS?
By using the @UseInterceptors() decorator at the method level
@UseInterceptors()
By extending the BaseController class and applying the interceptor in the constructor
BaseController
By registering the interceptor globally in the app.module.ts file
app.module.ts
By using the @Transform() decorator above the controller class
@Transform()
Which decorator type in NestJS is specifically designed to intercept and modify method arguments?
Method Decorator
Parameter Decorator
Property Decorator
Class Decorator