-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.test.js
42 lines (34 loc) · 991 Bytes
/
app.test.js
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
41
42
const request = require('supertest');
const app = require('./app.js');
let userid=null;
let sessionid=null;
describe('Test the login process', () => {
test('GET /pingtest succeeds', () => {
return request(app)
.get("/pingtest" )
.expect(200);
});
test('POST /login succeeds', (done) => {
return request(app)
.post("/login" ).send({email: "[email protected]", password: "Password"})
.expect(200)
.then(response => {
sessionid=response.body.sessionID;
userid=response.body.userID;
done()
})
});
});
describe('Test the character info retreival process', () => {
test('GET /char succeeds', () => {
return request(app)
.get("/char/" + sessionid.toString())
.expect(200);
});
test('GET /updatevalues succeeds', () => {
return request(app)
.post("/updatevalues/" + userid.toString())
.send({"Name": "UpdatedName"})
.expect(200);
});
});