-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
5 changed files
with
46 additions
and
24 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 |
---|---|---|
|
@@ -41,20 +41,22 @@ describe('Auth Controller Tests', () => { | |
it('should be able to sign up using email', async () => { | ||
const response = await app.inject({ | ||
method: 'POST', | ||
url: '/auth/send-verification-email', | ||
url: '/auth/email', | ||
payload: { | ||
email: '[email protected]', | ||
}, | ||
}); | ||
|
||
expect(response.statusCode).toEqual(201); | ||
expect(response.json().email).toEqual('[email protected]'); | ||
expect(response.json()).toEqual({ | ||
status: 'success', | ||
}); | ||
}); | ||
|
||
it('should send verification code to email on sign up', async () => { | ||
await app.inject({ | ||
method: 'POST', | ||
url: '/auth/send-verification-email', | ||
url: '/auth/email', | ||
payload: { | ||
email: '[email protected]', | ||
}, | ||
|
@@ -101,7 +103,7 @@ describe('Auth Controller Tests', () => { | |
// Sign up | ||
await app.inject({ | ||
method: 'POST', | ||
url: '/auth/send-verification-email', | ||
url: '/auth/email', | ||
payload: { | ||
email: '[email protected]', | ||
}, | ||
|
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
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 |
---|---|---|
@@ -1,14 +1,32 @@ | ||
import { AuthType } from '@prisma/client'; | ||
import { Exclude } from 'class-transformer'; | ||
import { Exclude, Expose } from 'class-transformer'; | ||
|
||
@Exclude() | ||
export default class UserResponseDto { | ||
@Expose() | ||
id: string; | ||
|
||
@Expose() | ||
email: string; | ||
|
||
@Expose() | ||
name: string; | ||
|
||
@Expose() | ||
location: string; | ||
|
||
@Expose() | ||
onboarded: boolean; | ||
|
||
@Expose() | ||
profilePictureUrl: string; | ||
|
||
@Expose() | ||
authType: AuthType; | ||
|
||
@Expose() | ||
isEmailVerified: boolean; | ||
|
||
@Expose() | ||
headline: string; | ||
} |
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
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 |
---|---|---|
|
@@ -54,7 +54,7 @@ describe('User Controller Tests', () => { | |
expect(prisma).toBeDefined(); | ||
}); | ||
|
||
it('should not be able to update itself if onboarding is not finished', async () => { | ||
it('should be able to update itself if onboarding is not finished', async () => { | ||
await prisma.user.update({ | ||
where: { | ||
email: '[email protected]', | ||
|
@@ -75,7 +75,14 @@ describe('User Controller Tests', () => { | |
}, | ||
}); | ||
|
||
expect(response.statusCode).toBe(401); | ||
const updatedUser = await prisma.user.findUnique({ | ||
where: { | ||
email: '[email protected]', | ||
}, | ||
}); | ||
expect(updatedUser.name).toBe('Jane Doe'); | ||
|
||
expect(response.statusCode).toBe(200); | ||
}); | ||
|
||
it('should be able to get the current user', async () => { | ||
|