Integration testing in NestJS primarily aims to verify what aspect of the application?
The security vulnerabilities within the codebase
The correctness of individual functions or methods
The interaction between different modules and components
The application's behavior in a real browser environment
What is the primary testing framework used for unit testing in NestJS?
Chai
Jasmine
Mocha
Jest
How does the CQRS pattern improve the design of event-driven systems?
By separating read and write operations for better performance and scalability
By eliminating the need for event listeners
By simplifying the handling of complex events
By enforcing synchronous communication between components
What is the primary function of a Pipe in NestJS?
To transform input data into the desired format.
To handle database queries and operations.
To manage dependency injection within the application.
To define middleware for routing HTTP requests.
What is the difference between HttpException and a custom exception class in NestJS?
HttpException
HttpException is used for generic HTTP errors, while custom exceptions represent specific business logic errors.
HttpException must be caught by custom exception filters, while custom exceptions are handled automatically.
HttpException is deprecated and should always be replaced with custom exception classes.
There is no practical difference; both can be used interchangeably for error handling.
What is the purpose of the 'ParseIntPipe' in NestJS?
To transform a numeric string into an integer.
To validate the data type of an input parameter.
To parse an object into a JSON string.
To convert a string value to a Boolean.
What is a common use case for a class decorator in NestJS?
Validating the structure of request payloads.
Adding common properties or methods to all instances of a class.
Modifying the response sent back to the client.
Defining custom route paths for controller methods.
Which NestJS module is essential for working with event emitters and listeners?
@nestjs/core
@nestjs/platform-express
@nestjs/event-emitter
@nestjs/common
Can you have both global and custom HTTP exception filters in a NestJS application?
Yes, but custom filters will only handle exceptions not caught by global filters.
Yes, but you need to explicitly specify the order in which they should be executed.
No, global exception filters take precedence and override any custom filters.
No, NestJS only allows you to define either global or custom exception filters, not both.
In NestJS, what is the primary mechanism for implementing an event-driven architecture?
Utilizing NestJS's built-in event emitter and listener system
Using HTTP requests and responses
Leveraging a message queue system like RabbitMQ
Directly calling methods between classes