Skip to content

Commit 3780298

Browse files
committed
Add test
1 parent ebd586e commit 3780298

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

test/auth.e2e-spec.ts

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
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+
16
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+
})
340
})

0 commit comments

Comments
 (0)