Skip to content

Commit 976c117

Browse files
committed
fix: add in semicolons
1 parent 67d590e commit 976c117

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

content/fundamentals/unit-testing.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ describe('CatsController', () => {
176176
})
177177
.useMocker((token) => {
178178
if (token === CatsService) {
179-
return { findAll: jest.fn().mockResolveValue(results) }
179+
return { findAll: jest.fn().mockResolveValue(results) };
180180
}
181181
if (typeof token === 'function') {
182-
const mockMetadata = moduleMocker.getMetadata(token) as MockFunctionMetadata<any, any>
183-
const Mock = moduleMocker.generateFromMetadata(mockMetadata)
184-
return new Mock()
182+
const mockMetadata = moduleMocker.getMetadata(token) as MockFunctionMetadata<any, any>;
183+
const Mock = moduleMocker.generateFromMetadata(mockMetadata);
184+
return new Mock();
185185
})
186186
.compile();
187187
controller = modRef.get(CatsController);
@@ -276,26 +276,27 @@ describe('Cats', () => {
276276
>
277277
> ```ts
278278
> let app: NestFastifyApplication;
279-
>
279+
>
280280
> beforeAll(async () => {
281281
> app = moduleRef.createNestApplication<NestFastifyApplication>(
282282
> new FastifyAdapter(),
283283
> );
284284
>
285285
> await app.init();
286286
> await app.getHttpAdapter().getInstance().ready();
287-
> })
288-
>
287+
> });
288+
>
289289
> it(`/GET cats`, () => {
290290
> return app
291291
> .inject({
292292
> method: 'GET',
293-
> url: '/cats'
294-
> }).then(result => {
295-
> expect(result.statusCode).toEqual(200)
296-
> expect(result.payload).toEqual(/* expectedPayload */)
293+
> url: '/cats',
294+
> })
295+
> .then((result) => {
296+
> expect(result.statusCode).toEqual(200);
297+
> expect(result.payload).toEqual(/* expectedPayload */);
297298
> });
298-
> })
299+
> });
299300
> ```
300301
301302
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)