Skip to content

Commit

Permalink
Add user profile e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBartusek committed Apr 30, 2024
1 parent bc90eb1 commit c7c0d12
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apps/api/test/users.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as request from 'supertest';
import { AppModule } from '../src/app.module';
import NestSetup from '../src/setup';
import { setupTestUser } from './setup-user';
import { UpdateUserDto } from '../src/models/users/dto/update-user.dto';

describe('UsersController (e2e)', () => {
let app: NestExpressApplication;
Expand All @@ -23,8 +24,16 @@ describe('UsersController (e2e)', () => {
});

it('/users/me (GET)', async () => {
return agent.get('/api/users/me').then((res) => {
expect(res.body.email).toBe('[email protected]');
});
const res = await agent.get('/api/users/me');
expect(res.body.email).toBe('[email protected]');
});

it('/users (PUT)', async () => {
const dto: UpdateUserDto = {
username: 'updated-username',
image: { hasImage: false },
};
const res = await agent.put('/api/users').send(dto).expect(200);
expect(res.body.username).toBe('updated-username');
});
});

0 comments on commit c7c0d12

Please sign in to comment.