Skip to content

Commit d17fd79

Browse files
authored
docs(unit-testing): move afterAll() to the end
in the example of e2e testing with Fastify
1 parent 0ba237b commit d17fd79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/fundamentals/unit-testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@ describe('Cats', () => {
287287
> await app.init();
288288
> await app.getHttpAdapter().getInstance().ready();
289289
> });
290-
>
291-
> afterAll(async () => {
292-
> await app.close();
293-
> });
294290
>
295291
> it(`/GET cats`, () => {
296292
> return app
@@ -303,6 +299,10 @@ describe('Cats', () => {
303299
> expect(result.payload).toEqual(/* expectedPayload */);
304300
> });
305301
> });
302+
>
303+
> afterAll(async () => {
304+
> await app.close();
305+
> });
306306
> ```
307307
308308
In this example, we build on some of the concepts described earlier. In addition to the `compile()` method we used earlier, we now use the `createNestApplication()` method to instantiate a full Nest runtime environment. We save a reference to the running app in our `app` variable so we can use it to simulate HTTP requests.

0 commit comments

Comments
 (0)