-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
f5bf431
commit 0454209
Showing
3 changed files
with
46 additions
and
9 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
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 |
---|---|---|
|
@@ -40,7 +40,9 @@ describe('Feedback Controller (E2E)', () => { | |
await app.getHttpAdapter().getInstance().ready() | ||
|
||
await cleanUp(prisma) | ||
}) | ||
|
||
beforeEach(async () => { | ||
user = await prisma.user.create({ | ||
data: { | ||
email: '[email protected]', | ||
|
@@ -52,8 +54,15 @@ describe('Feedback Controller (E2E)', () => { | |
}) | ||
}) | ||
|
||
afterEach(async () => { | ||
if (user) { | ||
await prisma.user.delete({ | ||
where: { id: user.id } | ||
}) | ||
} | ||
}) | ||
|
||
afterAll(async () => { | ||
await cleanUp(prisma) | ||
await prisma.$disconnect() | ||
await app.close() | ||
}) | ||
|
@@ -93,7 +102,7 @@ describe('Feedback Controller (E2E)', () => { | |
expect(statusCode).toBe(400) | ||
expect(JSON.parse(payload)).toEqual({ | ||
error: 'Bad Request', | ||
message: 'Feedback cannot be null', | ||
message: 'Feedback cannot be null or empty', | ||
statusCode: 400 | ||
}) | ||
}) | ||
|
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 |
---|---|---|
|
@@ -11,11 +11,11 @@ export class FeedbackService { | |
) {} | ||
|
||
async registerFeedback(feedback: string): Promise<void> { | ||
if (!feedback) { | ||
throw new BadRequestException('Feedback cannot be null') | ||
if (!feedback || feedback.trim().length === 0) { | ||
throw new BadRequestException('Feedback cannot be null or empty') | ||
} | ||
const adminEmail = '[email protected]' | ||
|
||
await this.mailService.feedbackEmail(adminEmail, feedback) | ||
await this.mailService.feedbackEmail(adminEmail, feedback.trim()) | ||
} | ||
} |