File tree 1 file changed +38
-1
lines changed
1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change
1
+ import mongoose from 'mongoose' ;
2
+ import { User } from '../src/models/user.model' ;
3
+ import { app , server } from '../src/app' ;
4
+ import request from 'supertest' ;
5
+
1
6
describe ( 'Auth tests' , ( ) => {
2
-
7
+ beforeAll ( async ( ) => {
8
+ await User . deleteMany ( )
9
+ mongoose . connection . close ( )
10
+ server . close ( )
11
+ } )
12
+
13
+ it ( 'Should be register' , async ( ) => {
14
+ const data = {
15
+ firstName : "test" ,
16
+ lastName : "test" ,
17
+ email : "test@gmail.com" ,
18
+ username : "test" ,
19
+ password : "123456"
20
+ }
21
+
22
+ return request ( app )
23
+ . post ( '/auth/register' )
24
+ . send ( data )
25
+ . expect ( 200 )
26
+ } )
27
+
28
+
29
+ it ( 'Should be login' , async ( ) => {
30
+ const data = {
31
+ username : "test" ,
32
+ password : "123456"
33
+ }
34
+
35
+ return request ( app )
36
+ . post ( '/auth/login' )
37
+ . send ( data )
38
+ . expect ( 200 )
39
+ } )
3
40
} )
You can’t perform that action at this time.
0 commit comments