Skip to content

Commit afc02be

Browse files
committed
change message of login, signup test
1 parent a3ddc93 commit afc02be

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

tests/routes/v1/login/index.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Login basic route', () => {
2121
createTokensSpy.mockClear();
2222
});
2323

24-
it('Should throw error when empty body is sent', async () => {
24+
it('Should send error when empty body is sent', async () => {
2525
const response = await addHeaders(request.post(endpoint));
2626
expect(response.status).toBe(400);
2727
expect(mockUserFindByEmail).not.toBeCalled();
@@ -30,7 +30,7 @@ describe('Login basic route', () => {
3030
expect(createTokensSpy).not.toBeCalled();
3131
});
3232

33-
it('Should throw error when email is only sent', async () => {
33+
it('Should send error when email is only sent', async () => {
3434
const response = await addHeaders(request.post(endpoint)
3535
.send({ email: USER_EMAIL })
3636
);
@@ -42,7 +42,7 @@ describe('Login basic route', () => {
4242
expect(createTokensSpy).not.toBeCalled();
4343
});
4444

45-
it('Should throw error when password is only sent', async () => {
45+
it('Should send error when password is only sent', async () => {
4646
const response = await addHeaders(request.post(endpoint)
4747
.send({ password: USER_PASSWORD })
4848
);
@@ -54,7 +54,7 @@ describe('Login basic route', () => {
5454
expect(createTokensSpy).not.toBeCalled();
5555
});
5656

57-
it('Should throw error when email is not valid format', async () => {
57+
it('Should send error when email is not valid format', async () => {
5858
const response = await addHeaders(request.post(endpoint)
5959
.send({ email: '123' })
6060
);
@@ -66,7 +66,7 @@ describe('Login basic route', () => {
6666
expect(createTokensSpy).not.toBeCalled();
6767
});
6868

69-
it('Should throw error when password is not valid format', async () => {
69+
it('Should send error when password is not valid format', async () => {
7070
const response = await addHeaders(request.post(endpoint)
7171
.send({
7272
@@ -81,7 +81,7 @@ describe('Login basic route', () => {
8181
expect(createTokensSpy).not.toBeCalled();
8282
});
8383

84-
it('Should throw error when user not registered for email', async () => {
84+
it('Should send error when user not registered for email', async () => {
8585
const response = await addHeaders(request.post(endpoint)
8686
.send({
8787
@@ -95,7 +95,7 @@ describe('Login basic route', () => {
9595
expect(createTokensSpy).not.toBeCalled();
9696
});
9797

98-
it('Should throw error for wrong password', async () => {
98+
it('Should send error for wrong password', async () => {
9999
const response = await addHeaders(request.post(endpoint)
100100
.send({
101101
email: USER_EMAIL,

tests/routes/v1/signup/index.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('Signup basic route', () => {
2424
createTokensSpy.mockClear();
2525
});
2626

27-
it('Should throw error when empty body is sent', async () => {
27+
it('Should send error when empty body is sent', async () => {
2828
const response = await addHeaders(request.post(endpoint));
2929
expect(response.status).toBe(400);
3030
expect(mockUserFindByEmail).not.toBeCalled();
@@ -33,7 +33,7 @@ describe('Signup basic route', () => {
3333
expect(createTokensSpy).not.toBeCalled();
3434
});
3535

36-
it('Should throw error when email is not sent', async () => {
36+
it('Should send error when email is not sent', async () => {
3737
const response = await addHeaders(request.post(endpoint)
3838
.send({
3939
name: USER_NAME,
@@ -50,7 +50,7 @@ describe('Signup basic route', () => {
5050
expect(createTokensSpy).not.toBeCalled();
5151
});
5252

53-
it('Should throw error when password is not sent', async () => {
53+
it('Should send error when password is not sent', async () => {
5454
const response = await addHeaders(request.post(endpoint)
5555
.send({
5656
email: email,
@@ -67,7 +67,7 @@ describe('Signup basic route', () => {
6767
expect(createTokensSpy).not.toBeCalled();
6868
});
6969

70-
it('Should throw error when name is not sent', async () => {
70+
it('Should send error when name is not sent', async () => {
7171
const response = await addHeaders(request.post(endpoint)
7272
.send({
7373
email: email,
@@ -84,7 +84,7 @@ describe('Signup basic route', () => {
8484
expect(createTokensSpy).not.toBeCalled();
8585
});
8686

87-
it('Should throw error when email is not valid format', async () => {
87+
it('Should send error when email is not valid format', async () => {
8888
const response = await addHeaders(request.post(endpoint)
8989
.send({
9090
email: 'abc',
@@ -101,7 +101,7 @@ describe('Signup basic route', () => {
101101
expect(createTokensSpy).not.toBeCalled();
102102
});
103103

104-
it('Should throw error when password is not valid format', async () => {
104+
it('Should send error when password is not valid format', async () => {
105105
const response = await addHeaders(request.post(endpoint)
106106
.send({
107107
email: email,
@@ -119,7 +119,7 @@ describe('Signup basic route', () => {
119119
expect(createTokensSpy).not.toBeCalled();
120120
});
121121

122-
it('Should throw error when user is registered for email', async () => {
122+
it('Should send error when user is registered for email', async () => {
123123
const response = await addHeaders(request.post(endpoint)
124124
.send({
125125
email: USER_EMAIL,

tests/routes/v1/signup/mock.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const USER_PROFILE_PIC = 'https://abc.com/xyz';
99

1010
export const bcryptHashSpy = jest.spyOn(bcrypt, 'hash');
1111

12-
1312
export const mockUserCreate = jest.fn(async (user: IUser, accessTokenKey: string, refreshTokenKey: string, roleCode: string)
1413
: Promise<{ user: IUser, keystore: IKeystore }> => {
1514
user._id = new Types.ObjectId();

0 commit comments

Comments
 (0)