-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc90eb1
commit c7c0d12
Showing
1 changed file
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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'); | ||
}); | ||
}); |