-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.test.js
More file actions
41 lines (33 loc) · 983 Bytes
/
server.test.js
File metadata and controls
41 lines (33 loc) · 983 Bytes
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
const request = require("supertest");
const app = require('./routes/User');
const mongoose = require('mongoose');
describe("Test the root path", () => {
test("It should response the POST method", () => {
const response = request(app).post("http://localhost:8000/User/Add")
.send ({
"Name": "Obaid",
"Email": "obaid",
"Age": 12,
"Contact": 123
})
expect(response.statusCode).toBe(200);
})
})
describe("Test the root path", () => {
test("It should response the DELETE method", () => {
const response = request(app).delete("http://localhost:8000/User/:id")
.send ({
"id": '1234567'
})
expect(response.statusCode).toBe(200);
})
})
git
test("It should response the POST method", () =>
{
const response = request(app).post("http://localhost:8000/User/add"
).send ({
"Name": "Amna"
})
expect(response.statusCode).toBe(200);
})