-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.test.js
More file actions
37 lines (33 loc) · 1.1 KB
/
Copy pathserver.test.js
File metadata and controls
37 lines (33 loc) · 1.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
const request = require("supertest");
const app = require('./routes/User');
const mongoose = require('mongoose');
describe("Test the root path", () => {
test("It should response the get method", () => {
const response = request(app).post("http://localhost:8000/User/add").send({
"Name": "Tayyab",
"Email": "tayyabqaisar41514@gmail.com",
"Age": 12,
"Contact": 123,
})
expect(response.statusCode).toBe(200);
})
})
describe("Check for user added", () => {
test("user added", () => {
const response = request(app).post("http://localhost:8000/User/add").send({
"Name": "Qaisar",
})
expect(response.statusCode).toBe(200);
})
})
describe("Check for user deleted", () => {
test("user deleted", () => {
const response = request(app).post("http://localhost:8000/User/delete").send({
"Name": "Tayyab",
"Email": "tayyabqaisar41514@gmail.com",
"Age": 12,
"Contact": 123,
})
expect(response.statusCode).toBe(200);
})
})