Skip to content

Commit 462624e

Browse files
committed
feat: fix some test, should not affected on other data in database
1 parent e7a7723 commit 462624e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

test/spec/address.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('Address Controller Test', () => {
2828
beforeEach(async () => {
2929
await testService.deleteAddress();
3030
await testService.deleteContact();
31-
await testService.deleteAll();
31+
await testService.deleteUser();
3232
});
3333

3434
it('should return 400 if request is invalid', async () => {

test/spec/contact.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Contact Controller Test', () => {
2626

2727
describe('POST /api/contacts/', () => {
2828
beforeEach(async () => {
29-
await testService.deleteAll();
29+
await testService.deleteUser();
3030
});
3131

3232
it('should return 400 if request is invalid', async () => {

test/spec/user.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('User Controller Test', () => {
2929

3030
describe('POST /api/users', () => {
3131
beforeEach(async () => {
32-
await testService.deleteAll();
32+
await testService.deleteAllUser();
3333
});
3434

3535
it('should be return 400 when request is invalid', async () => {
@@ -47,7 +47,7 @@ describe('User Controller Test', () => {
4747
const response = await request(app.getHttpServer())
4848
.post('/api/users')
4949
.send({
50-
email: 'example@example.com',
50+
email: 'jayog57874@gitated.com', // temp mail
5151
name: 'example',
5252
username: 'example',
5353
password: 'secret123',
@@ -57,7 +57,7 @@ describe('User Controller Test', () => {
5757
logger.info(response.body);
5858

5959
expect(response.status).toBe(201);
60-
expect(response.body.data.email).toBe('example@example.com');
60+
expect(response.body.data.email).toBe('jayog57874@gitated.com');
6161
expect(response.body.data.emailSent).toBe(true);
6262
});
6363

@@ -315,6 +315,6 @@ describe('User Controller Test', () => {
315315
});
316316

317317
afterAll(async () => {
318-
await testService.deleteUser();
318+
await testService.deleteAllUser();
319319
});
320320
});

test/test.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class TestService {
1515
});
1616
}
1717

18-
async deleteAll() {
18+
async deleteAllUser() {
1919
await this.prismaService.user.deleteMany();
2020
}
2121

0 commit comments

Comments
 (0)