-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.e2e-spec.ts
40 lines (34 loc) · 930 Bytes
/
auth.e2e-spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import mongoose from 'mongoose';
import {User} from '../src/models/user.model';
import {app, server} from '../src/app';
import request from 'supertest';
describe('Auth tests' , ()=>{
beforeAll(async()=>{
await User.deleteMany()
mongoose.connection.close()
server.close()
})
it('Should be register' , async ()=>{
const data = {
firstName : "test" ,
lastName : "test" ,
email : "test@gmail.com",
username : "test" ,
password : "123456"
}
return request(app)
.post('/auth/register')
.send(data)
.expect(200)
})
it('Should be login' , async ()=>{
const data = {
username : "test" ,
password : "123456"
}
return request(app)
.post('/auth/login')
.send(data)
.expect(200)
})
})