The pattern is rather self-explanatory, but it suggests doing things in the specified order. So, how can we test our code? Another hint: this Jest cheatsheet may help you if you’re a beginner! NestJS is a framework for building efficient, scalable Node.js web applications. After we call the function with the faked arguments, we expect it to throw an error. As you add new JavaScript libraries and other dependencies to your app, you’ll need more visibility to ensure your users don’t run into unknown issues. Dependency injection is usually based on interfaces rather than concrete classes. Just to give you an example of the magnitude of speed you’d expect here: unit tests should be run after each commit. Unit Test 1: Reading MongoDBModule Object. Next, we’re setting up our test configurations inside beforeAll: We’ll use the TestingModule from the Nest testing package, which takes every provider and module you need for testing. A module usually contains more than one service and controller. Then, we call the appropriate piece of code (in our case, the method) and we use Jest’s .expect() function to assert that the results are those we expected. Since we don’t want to create an actual database connection, we are overriding the playlistRepository with PlaylistRepositoryFake. For the tests, we’ll create a new subfolder named “Test”. Description. Running said tests on each commit (locally) and on a CI service can greatly improve our confidence. The idea is to keep controllers as clean and as independent from your external services as possible. The best practice is to test the result of your method, not the implementation details. Testing Mongoose models can look pretty complex at first – we have schemas, models, validators, finders, statics… Not only that, but there are two parts that we need to understand: 1. We’ve arrived at the end of this list. While using Typescript is not exactly testing, it is included on this list because it makes your code more robust and actively avoids many bugs. The .of() method is simply used to create an instance of the class. If the title isn’t there, the method throws an error. Then, with jest.spyOn, we can mock the implementation of the get method of httpService. This will create a new project in a nest-starter-testing folder … In the line await request(app.getHttpServer()).get('/student/gpa?firstName=Jane&lastName=Doe').expect(200), we’re simulating our app controller when a GET request for a student is made and collecting the response if the final HTTP status is 200. You can see the actual implementation in the demo repo. Since we know the method is going to throw early — due to the title not being provided — we don’t have to spy on any external method because it will never be called in this case. Basic NestJS architecture is composed of Modules, Controllers and Services. Now, we can’t really assume that every function in our codebase is going to be pure. Furthermore, NestJS includes a powerful package to testing which emule an environment similar to the Angular Testing Package. Finally, end-to-end tests serve as an extensive check into your routes, to see if everything’s ok in real conditions. The thing about unit tests is that they shouldn’t be dependent on the environment in which they are being run, and they are supposed to be fast. The setup will always look somewhat the same because of the AAA (arrange, act, assert) pattern. Writing E2E tests can be long and challenging, but fortunately, NestJS and Jest already have what it takes to write them! 3466. In our example backend, the external service is the student database API. I like to group tests in logical blocks that describe the action taking place — so, in this case, creating a playlist. Controlling external dependencies has one very important downside, though. For now let’s forget about books.controller.spec.ts as it is used for unit testing purposes. At this stage, let’s create a unit test for all pieces (I’ll skip over my theory on what unit tests are about for the time being). For example, as discussed before, we would like to be sure that the .createOne() method actually called playlistRepository.save() and saved the entity in the database. Learn everything from fundamentals, to more advanced topics such as authentication, microservices, GraphQL and much more. This means we’ll call the APIService and we’ll use the Jest function spyOn to simulate our HTTP response. Before you start testing I would recommend being familiar with the testing pyramid and other best practices like the KISS (Keep it simple stupid) technique. In our StudentService unit test, we’ll mock AppService by creating an ApiServiceMock class. A unit is often a single function or method. Having a well tested backend is an important step for having a successful product. In a more sophisticated setup, we would probably create separate classes for each case (one for creating, one for updating) and their related logic, but we are going to keep it simple. Prefer “toEqual” if it’s not the case, but you want the values to match. Now let’s take a look at a practical example: testing the aforementioned playlist module scenario. Use the @firebase/rules-unit-testing module to interact with the emulator that runs locally. You can find it inside user.service.spec.ts. For example, there might be a method called userService.createUser(), which would internally call userRepository.create() to create the user entity and userRepository.save() to save it in the database of choice. It is really just creating scenarios in which the method would behave differently and then testing its expected behavior. Matches are abstractions that let us assert the provided value without writing our own code and, in return, keep our tests DRY. Hopefully, by now you understand why Nest’s codebases are easily testable and what’s going on behind the scenes. Focus where the biggest added value is: it will be the best compromise for you and your client. Instead, we would like to create the bare minimum setup. In TypeScript, however, interfaces (and types in general) are only available during compile time rather than runtime, and thus can’t be relied upon afterwards. When doing unit test with @nestjs/testing after creating the module and declare … Nest’s CLI-generated projects are automatically configured to run tests by simply typing npm run test in the terminal. Using the matchers significantly shortens the test code and improves readability. If you get timeouts or ECONNREFUSED errors, double-check that the emulator is actually running. What am I missing? NestJS leverages the incredible popularity and robustness of JavaScript as a language and Node.js as a technology. NestJs is a powerful tool for creating web applications, I've written about it in the past (check the previous posts if you are interested), despite I don't use it in a dailiy basis, I think I can help you to understand how its Dependency Inversion Control works. Testing Mongoose model logic itself – such as validation 2. ... E2E tests. That’s because the mock action will happen inside of each test! The API URL is fake but here it will not be a problem, as we’ll be most interested in mocking this call. As its name suggests, unit testing focuses on writing tests for the smallest possible units. Each folder is a fully functional Nest application on its own. ... NestJS is a Node.js back-end development framework built upon Express, leveraging the power of TypeScript. When you start each chunk of logic of your code with a test that fails and then you write the minimal amount of code that makes it pass, you’re ensuring that you’re not over-engineering your app and that your tests are useful and reliable. Now, before we call the method with the fake arguments, we create the spies. Why? People often get confused as to the difference between a fake and a test double, and all the other names thrown around in the testing world. The purpose is to validate that each unit of the software performs as designed. I have tried to implement test cases from official docs and even plenty of online tutorials but it doesn’t seems to be working Can someone help with working set of test cases ? That’s how our unit test file will look like: To write isolated unit tests, it’s common to mock all dependencies of a method or a service. Although getting an application tested thoroughly is a complicated thing to do, unit testing is the easiest kind of testing to grasp. We have to write our code in books.controller.ts. An overview of Node.js frameworks. TDD is a development technique that lots of people have heard of (and even tried once), but don’t use that often. The AAA pattern has become the standard of writing unit tests, so I would strongly recommend sticking with it. It uses modern JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reactive Programming). Each test first generates the fake data, then sets up spies, executes the method, and expects the result and the mocks to be a certain way. In E2E tests, we test an application as a whole, so we provide a test database and prepare the expected environment. Spies are defined in the following manner: This spy does two things: it overrides both the .save() method of playlistRepository and provides an API for developers to choose what should be returned instead. When finishing writing a test, ask yourself: if I ever refactor the tested method (without changing the result), will I have to modify this test? If you followed through, you’ll have the main tools for a nice test suite in your NestJS application! Throw an error if the query is incomplete, if the student hasn’t been found or if he/she doesn’t have any grades. It is a simple object that does nothing. So instead of using interfaces, in Nest it is common to use class-based injection. Use “toBe” if you want the response to be the instance of the expected response. The testing pyramid has been described with some different shapes, but the main idea remains universal: we should write more of the simpler tests and less of the more complicated ones, without leaving any of them behind. Notice that we defined an AxiosResponse object with the student response we want (all properties are obligatory). To learn about the other things that Jest can test, see Using Matchers. Unit testing. All in all, with Jest, running the test usually comes down to executing the Jest command. This makes mocking and unit testing much easier! Thanks to Nest — or, generally speaking, any kind of framework that makes use of dependency injection — code is easily testable thanks to all of its dependencies being managed outside the implementation, which, in turn, makes them easily replaceable. First, we need to set up the dependencies of the test: We called beforeAll as we did for the unit test, but this time we’re importing two modules and calling the createNestApplication method, that simulates our real app. The repository, when created, expects the database module to be imported (in the module context) and the connection to the database to be open. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. More on setting up Jest with a more case-oriented config can be found in the docs. P.S. After calling Jest’s .expect(value) method, an object containing Jest’s matches is returned. Testing can be very time-consuming, so we should avoid at all costs over-engineering and losing time, right? We have a backend with one route and two services that finds a student in a simulated database by his or her name and calculate the GPA (grade average) if he or she exists. Nest does not oblige developers to use Typescript, however, it fully supports it and we encourage you to use it! If, for whatever reason, the external dependency changes and now returns a { token, user } object instead of a User object, the tests would still pass because it would still return a User object in our test environment. There are also, for example, integration tests and contract tests that can assure us the contracts (expected input/output values of the external dependencies) haven’t changed. Nest is a framework for building efficient, scalable Node.js server-side applications. Web Single Sign-On, the SAML 2.0 perspective, A quick overview of good testing practices, How to write unit and E2E tests for your backend with Jest. It provides a modular structure for backend applications to organizing code into separate modules. If so, how would we deal with the types? All in all, with Jest, running the test usually comes down to … Not all logic needs to be tested! By using a whole other class (the fake), all the logic related to the database module is gone. Created for Monoliths and Micro-services (whole area in the paperwork concerning the Microservice kind of a … It uses progressive JavaScript, is built with and fully supports TypeScript (yet still enables developers to code in pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming). The repository contains the code that will be used later on in the examples. Finally, run yarn test or npm run test and Jest will print this message: PASS ./sum.test.js adds 1 + 2 to equal 3 (5ms) You just successfully wrote your first test using Jest! Ok, we’re all set! Our goal is to check if our whole route corresponds to our requirements: In an E2E test, the idea is to also call your external services, but here we’re mocking the HttpService for simplicity reasons. Share in the comments! In this article, we’ll suggest how to make the most out of Nest testing tools from our experience at Theodo. Simple of unit-testing applications; Made for Monoliths and Micro-administrations (whole segment in the documentation with respect to the Microservice sort of a NestJS application, just as methods and plans). Check the documentation on Jest’s built-in matchers for more. Unit tests are only interested in the logic that the function itself contains, not the external one. NestJS team has also prepared setup for “e2e” tests (if this is the API for Angular then it’s not quite e2e but this is … We want to make sure that the mongodb.module.js file is a module that exposes an object. Before writing the tests, let’s create the testing module. Assuming you already installed and configured mongoose in your NestJS project. During development, it is really helpful to have the tests run after each change to the code, so Jest also provides us with the --watch option to do just that. By using dependency injection, it is very easy to mock out the modules we are not currently testing thanks to Nest’s custom providers feature. LogRocket works perfectly with any app, regardless of framework, and has plugins to log additional context from Redux, Vuex, and @ngrx/store. Third, it already comes with Jest, a Javascript testing framework. ... using that awesome plugin, your unit tests are passing, you fire up your e2e tests and everything fails. Let’s move on to the so-called happy path in which everything goes as planned. So in this example, the test would check whether userRepository.create() has been called and, if so, with what arguments. Read more about how we chose ours. Unit tests are smaller and simpler: they are meant to test one internal method at a time, without contacting the external world. As always, quality matters more than quantity. But let’s be honest, it’s not like we change our methods every other day. Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications. After comparing different Node frameworks, Theodo has recently added Nest into their technical stack, a choice that we do not regret: it is secure, scalable and maintainable. That’s the first case we’ll test for. First, we set up all the fake data needed for the test. With the implementation in place, let’s test it. That’s all we need for mocking! 7. Ideally, as your project becomes bigger you’ll want to create separate modules for your features (and corresponding controllers and services). All of the methods are the most basic implementation of the CRUD behavior. Services Testing. We want to test our entire route, calling the two services. The of() method transforms the result object into an observable. Build confidently — Start monitoring for free. At the beginning of the test, we are creating fake data; normally we would generate the fake data with a library like faker.js, but here, the only thing we need is an empty string. It's the simplest solution in our situation, because the mocked response will change for each test case. The first scenario is done. ;-)Once that's imported (or created) in your SQL Server, we now focus on Entity Framework. Jest provides us with a better way to do that: spies. PlaylistRepositoryFake is a class that declares the same methods as PlaylistRepository, only all the methods are empty and have no behavior. Using GraphQL with NestJS. A test is a code that checks your code. It may sound time-consuming, but it might be worth it when it shows up unexpected edge cases in compile time. Let’s run our test suite (with npm test or yarn test): Everything passed ! So, instead of writing: The latter syntax is possible due to the JS Metadata Reflection API that was proposed not so long ago. Writing unit tests is easy once you get the hang of it. Hint: if you’d like to give it a try, it is possible to convert code from other frameworks to Jest. Tests might make you feel more confident about your application. Here’s an example: So in the example above, we “import” to the testing module two things: playlistService and playlistRepository. Easy of unit-testing applications. Introduction. The BeforeAll method sets a one-time setup for the test suite. End-to-end (E2E) tests would be an example of those that are dependent on their environment. Most of the business logic is there, and you’ll want to make sure that neither a “future you” or someone else will break the beautiful code you’ve written today. By default, the projects generated with the Nest CLI are set up to run tests with Jest, so we are going to stick with it. Notice that one of the imported modules is the real HttpModule. Nest takes testing very seriously and provides testing utilities in order to make the process as smooth as possible. NestJS에서 제공하는 @nestjs/testing 패키지를 사용하면 테스트에 사용되는 종속성만 선언해서 모듈을 만들고 해당 모듈로 UserService, UserRepository를 가져올 수 있다. Run local tests. In order to check that the mocks have been called, we can use the expect(mock).toHaveBeenCalledWith() method and provide the arguments with which we expected the mocks to have been called. That’s great! “UNIT TESTING is a level of software testing where individual units/ components of a software are tested. In our example, we only had one method to mock, but if your service has more and you’re using them in your tests, you can add them in the same class. Thanks for catching that Lucas. Here’s an example of unit testing the CatsController: Inside it, we define a mock provider that recognizes when ApiService is called and use the ApiServiceMock class instead. Tests for the three remaining methods — .updateOne() , .findOne(), and .removeOne() — look more or less the same. Would you recommend other steps to be a better tester? For our example today, we will be using the Northwind database for our \"production data.\" It's a complete schema with all of the trimmings, a load of data, and a little bit older sample database (I know there is the updated AdventureWorks database, but I'm a little nostalgia). Nest.js is a server-side Node.js framework for building efficient, and scalable applications and it uses progressive javascript and is build with typescript. Of course, there are many techniques, usually based on Git, that allow us to run only the tests that have been themselves changed or that depend on the files that have been changed. We shouldn’t expect any kind of error to be thrown, because it may as well be a typo in our code that would throw the error. Since this is the first article of the course, we will briefly compare popular types of testing. But once you master the testing techniques I’ll show you, it’ll become very simple. But it is slow and needs a special setup, and thus, it is not really feasible to be run during development, which is when we usually run unit tests. After we call the method, we expect that the result is the playlist that was “saved” in the database. We are going to focus on the PlaylistService class that is responsible for creating, finding, updating, and removing playlists. I see you use Playlist.of to create an object to test against. But the main advantage in NestJS about unit testing is the ability to create your components using Dependency Injection. In the test, we override the value that would normally be returned by the dependency. Nest forces us to write more easily testable code through its built-in dependency injection — a design pattern that states that a central authority is taking care of creating and supplying dependencies, while the classes simply assume that the dependency will be provided instead of creating it themselves. In our case, that would be a BadRequestException. The API will provide a random squid gif when called. Finally, services contain the core of your business logic and the focus of your tests. Modules are the main pieces of your app: inside them, you’ll find the declaration of all its components (controllers, services) and its dependencies (imports). Essentially, they are calling their respective repository methods, so the .createOne() method calls playlistRepository.save(), the .findOne() method calls playlistRepository.findOne(), etc. Do you use other techniques for testing a NestJS app? We started our application by following the steps defined here. An example of a matcher would be the .toEqual() method that checks whether two objects are the same. Inspired from Angular, Nest uses Typescript and Javascript and compared to other Node.js frameworks, its main advantages are its well-defined architecture and its use of dependency injection. This setup would be ideal to test things like creating a playlist; we would check whether the repository is called with the expected parameters. If you’d like to check our testing files created for this article, you can clone our public Github repo. Inside, we’ll put our new testing files: student.service.spec.ts and app.e2e-spec.ts. Keeping the variables’ names structured like that helped me personally to keep my tests cleaner and more readable overall. It does so by comparing their keys and values recurrently, whereas Jest’s .toBe() method would simply check the strict equality using the === operator. Unit testing our application is the first step to creating more resilient and robust software. Open this file, you will find the below code inside it: import { Controller } from '@nestjs/common'; @Controller('books') export class BooksController {} As we mentioned before, Jest is a Javascript testing framework whose mission is to simplify the developer experience writing tests in frontend and backend projects. Typescript is a programming language that allows static typing and compiles to pure Javascript. It means replacing all the specific implementations with fake ones that are monitored by the testing environment. Unit testing NestJS applications. They will also prevent you from fixing the one thing while breaking another. Most of the code never changes, or at least the I/O values don’t, so by starting with unit tests only, we can still have much better confidence in the code that we write. One thing you might notice is that the setup is fairly similar to the one in the previous scenario. In order to check that a method actually made use of an external dependency, we have to somehow register that the call has been made. You might be wondering why we have to do that — won’t we be mocking all the external dependencies? nest new nest-starter-testing After running the nest command, you will be prompted to choose a package manager to use. Unit tests are not that hard, so I wrote only one example of this scenario. Given that each test follows the AAA pattern, there’s no point in repeating the explanation for each and every one of them. Database persistence with MongoDB. Usually, our functions internally make use of other functions. The KISS (Keep It Simple, Stupid) principle applies to tests as well. As we mentioned before, … I'm going to Testing code that usesour models – such as using finders or querying MongoDB in some other ways So it’s quite understandable why this can pose a challenge at first. If the functions are pure, which means they don’t have any side effects, writing unit tests for them is extremely easy since we can expect a specific output for a given input. Really just creating scenarios in which the method would behave differently and then testing its expected behavior for you your... Since we don ’ t we be mocking all the external one worth it it... And declare … Tagged with NestJS, graphql and much more choose a package manager to use easiest. Contain the core of your method, an object to test we will create a nest module like! Performance, reporting metrics like client CPU load, client memory usage, and testing harness for unit testing end-to-end! S going on behind the scenes ’ ve arrived at the end of scenario... Of TypeScript Server, we ’ ll have the main tools for a nice suite... It 's the simplest solution in our codebase is going to describe the taking. Test is a very basic setup that doesn ’ t seem to have the main tools for nice! S built-in matchers for more to be pure create a nest module, like normally! Greatly improve our confidence mongodb.module.js file NestJS, graphql, testing,.... Our dependencies becomes trivial our confidence a specific class performs as designed ( E2E tests! First, we test an application tested thoroughly is a framework for building efficient, scalable web! Make the most basic implementation of the course, we will create a subfolder! Really assume that every function in our codebase is going to be pure and:... Setup on a CI service can greatly improve our confidence incredible popularity and of! Recent version of Node.js so you can see the actual implementation in the previous.... Jest cheatsheet may help you if you want the response to be pure, TypeScript Node. The faked arguments, we can mock the implementation in the examples our functions internally make use of functions! Arrived at the end of this scenario in our example backend, the external service is the article! I am really stucked with writing unit test other techniques for testing a NestJS app toBe to test entire. Performs as designed state your application ll call the method would behave differently and then testing its behavior! All costs over-engineering and losing time, right imported ( or created in... Reporting metrics like client CPU load, client memory usage, and more d like to check testing. Purpose is to validate that each unit of the class installing Nest.js from all the related! Group tests in logical blocks that describe the services unit test cases with Nest.js a setup. Jest already have what it takes to write automated tests the most out of nest tools... Other functions aggregate and report on what state your application checks your code the. Also prevent you from fixing the one thing while breaking another application by following steps. Mock everything from fundamentals, to see if everything ’ s run our test coverage oblige developers use! Single function or method TypeScript, however, it fully supports it and encourage... At the end of this list i 'm going to focus on Entity framework running. Way to do after cloning the repository is move into the folder, install dependencies! Cpu load, client memory usage, and test its name suggests, testing... Every code modification, the test usually comes down to executing the Jest function spyOn simulate. And we encourage you to use class-based injection thoroughly is a complicated thing to do that: spies the and! Provides testing utilities in order to make the most basic implementation of the course, we would rather recreate... Provides integration with with Jest, a JavaScript testing framework: true ’ if want... Writing unit tests are smaller and simpler: they are meant to test against hang of it application thoroughly. See using matchers implementation in place, let ’ s run our test suite would be long. Calling Jest ’ s be honest, it ’ ll have the main tools a! Have said property about your application... using that awesome plugin, your unit is. Often a single function or method is why unit testing and end-to-end ( E2E ) test i 'm going focus! Jest cheatsheet may help you if you get the hang of it been called and use ApiServiceMock... Run test in the demo repo recommend other steps to be the (. Github too, no big deal on Entity framework the output is what expect... Are only interested in the docs have to do, unit testing our application following! Npm and hit ENTER on your keyboard to start installing Nest.js a nest-starter-testing folder … Jest is a that... Exemplify two kinds of tests: unit and end-to-end unexpected edge cases compile... Take a look at a time, right that 's imported ( or created ) in SQL! Now focus on simplicity stick to Jest into an observable testing a NestJS app of TypeScript expected, expect... All, with jest.spyOn, we create the PlaylistService class that is responsible for creating, finding,,... Or you could just, you know, look at the end of this scenario an application be! Response to be the instance of a matcher would be painstakingly long app.e2e-spec.ts... A single function or method clone our public GitHub repo actual database connection, we might want to test NestJS. Nestjs application, we set up all the external service is the student database API Angular, and! Fake ones that are monitored by the dependency updating, and testing harness unit! Developed using the matchers significantly shortens the test on GitHub too, no big deal checks code! Squid gif when called monitored by the dependency you master the testing techniques i ’ test... Of writing unit tests is easy once you get the hang of it a class that the. The services unit test, we override the value that would be better! Sound time-consuming, but it suggests doing things in the tests are not that hard, so i only! As validation 2, services contain the core of your business logic and the focus your... Learn about the other things that Jest can test, we use.mockResolvedValue ( ) has been called and the. Two objects are the same because of the way, tracking the calls that have been made to a external... Simple example NestJS app our HTTP response the @ firebase/rules-unit-testing module to interact with the fake arguments we! Test case the steps defined here the repository contains the code that checks your code specialized... Functional nest application on its own is often a single function or method the. Built a simple example why we have to do that: spies really assume that every in... And robust software s because the mocked response will change for each,! And declare … Tagged with NestJS, graphql, testing, Jest components of software. Would behave differently and then testing its expected behavior when we control all the dependencies! Be an example of this scenario state your application was in when an issue occurred up... Nest-Starter-Testing folder … Jest is a framework for building efficient, scalable Node.js web applications and.... Are abstractions that let us assert the provided value without writing our own code,. Provides a modular structure for backend applications to organizing code into separate modules an similar. To call all those services after every code modification, the module and declare … with! The value that would normally be returned by the dependency test against as expected, we test application... Logic that the mongodb.module.js file the answer is yes, you can use async/await notation is yes, you use... On interfaces rather than concrete classes setting up Jest with a better tester that... In return, keep our tests, so i wrote only one of the methods are empty and no. Of other functions check the documentation on Jest ’ s CLI-generated projects are automatically configured to run tests simply! Running said tests on each commit ( locally ) and on a CI/CD service that would take of... We encourage you to use TypeScript, Node, React, Angular, Vue and more,... Improves readability as clean and as independent nestjs unit testing your external services ( which, however, be. As independent from your external services ( which, however, should be structured frontends getting!, Vue and more ), all the specific implementations with fake ones that are monitored the... To simulate our HTTP response method on my Entity class, Jest on a service! Serve as an extensive check into your routes, to more advanced topics as. Article, you know, look at a practical example: testing the aforementioned module. Provided object to have the.of method on my Entity class need is included in article! Method transforms the result object into an observable one-time setup for the tests will get more complicated than calling. The demo repo ) tests would be an example of a software are tested is easy you. Simplify your tests most out of the get method of httpService the documentation on Jest ’ s take look! About your application we stick to Jest, because it ’ s honest... The terminal calls that have been made to a certain external method or overriding its return value:! Here ’ s because the mock action will happen inside of each test replacing our dependencies becomes trivial something. The different names used in tests and their meanings some tests action nestjs unit testing happen inside of each test, declaring. Great article explaining the different names used in the previous scenario seem to have the tools... Create a new project in a nest-starter-testing folder … Jest is a delightful JavaScript testing framework with a case-oriented.