Skip to content

Commit ffe35c3

Browse files
committed
Fix linter
1 parent 51b5423 commit ffe35c3

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ async function bootstrap() {
2727
await app.listen(port);
2828
}
2929

30-
bootstrap();
30+
void bootstrap();

test/users.e2e-spec.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Test, TestingModule } from '@nestjs/testing';
22
import { INestApplication, ValidationPipe } from '@nestjs/common';
3-
import request from 'supertest';
4-
import { AppModule } from '../src/app.module';
3+
import * as request from 'supertest';
4+
import { AppModule } from 'src/app.module';
5+
import { User } from 'src/users/entities/user.entity';
56

67
describe('UsersModule (e2e)', () => {
78
let app: INestApplication;
@@ -26,27 +27,33 @@ describe('UsersModule (e2e)', () => {
2627
email: 'simone@example.com',
2728
};
2829

29-
const res = await request(app.getHttpServer())
30+
const server = app.getHttpServer() as unknown as Parameters<typeof request>[0];
31+
32+
const res = await request(server)
3033
.post('/api/v1/users')
3134
.send(userDto)
3235
.expect(201);
3336

34-
expect(res.body).toEqual({
37+
const user = res.body as User;
38+
expect(user).toEqual({
3539
id: expect.any(Number),
3640
name: userDto.name,
3741
email: userDto.email,
3842
});
3943
});
4044

4145
it('/api/v1/users (GET) should return all users', async () => {
42-
const res = await request(app.getHttpServer())
46+
const server = app.getHttpServer() as unknown as Parameters<typeof request>[0];
47+
48+
const res = await request(server)
4349
.get('/api/v1/users')
4450
.expect(200);
4551

46-
expect(Array.isArray(res.body)).toBe(true);
47-
expect(res.body[0]).toHaveProperty('id');
48-
expect(res.body[0]).toHaveProperty('name');
49-
expect(res.body[0]).toHaveProperty('email');
52+
const users = res.body as User[];
53+
expect(Array.isArray(users)).toBe(true);
54+
expect(users[0]).toHaveProperty('id');
55+
expect(users[0]).toHaveProperty('name');
56+
expect(users[0]).toHaveProperty('email');
5057
});
5158

5259
afterAll(async () => {

0 commit comments

Comments
 (0)