forked from Qasem-moh/Jam3ey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuper-controller.test.js
More file actions
59 lines (47 loc) · 2.1 KB
/
super-controller.test.js
File metadata and controls
59 lines (47 loc) · 2.1 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
// const superController = require('./controller/super.controller');
const {app} = require('./server');
const supertest = require('supertest');
const request = supertest(app);
describe('supervisor tests', ()=> {
// ----------------------- test fot sign up new supervisor -------------------
it('signup for supervisor', async () => {
let obj = {
userName: "mmmmm",
email: "mm@mmm.com",
password: "1234"
}
const response = await request.post('/v1/signup').send(obj);
expect(response.status).toEqual(201);
});
// ----------------------- test fot sign in supervisor -----------------------
it('signin for supervisor ', async () => {
const response = await request.post('/v1/signin').set('Authorization', `Basic bW1AbW1tLmNvbToxMjM0`);
expect(response.status).toEqual(200);
// console.log('responseeeboddyy',response.body);
expect(response.body.supervisor.userName).toBe('mmmmm');
});
// ----------------------- test for create room ------------------------------
it('test for creat room ', async () => {
const reqBody={
"classroom":"class11"
}
const response = await request.post('/v1/data').send(reqBody);
expect(response.status).toEqual(200);
});
// ----------------------- test for show all rooms ------------------------------
it('test for get all rooms ', async () => {
const response = await request.get('/v1/data');
expect(response.status).toEqual(200);
});
// ----------------------- test for show specific room according to its id ------------------------------
it('test for get specific room', async () => {
const response = await request.get('/v1/data/1');
expect(response.status).toEqual(200);
});
// ----------------------- test for delete specific room according to its id ----------------------------
it('test for delete specific room', async () => {
const response = await request.delete('/v1/data/2');
expect(response.status).toEqual(200);
});
});