Skip to content

Commit 0f6eb6c

Browse files
Write-testcases-for-students
1 parent ad7996e commit 0f6eb6c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/routes/student.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ afterAll((done) => {
3131

3232
describe("Student API", () => {
3333
it("should create student", async () => {
34-
const response = await agent.post("/student/add").send({
34+
const response = await agent.post("/student/create").send({
3535
ERPID: "S1032220999",
3636
name: "Arya",
3737
joiningYear: 2020,
@@ -42,13 +42,13 @@ describe("Student API", () => {
4242
});
4343

4444
expect(response.status).toBe(200);
45-
expect(response.body.res).toMatch(/added student/);
45+
expect(response.body.res).toMatch(/added user/);
4646
});
4747

4848
describe("after adding student", () => {
4949
let id;
5050
beforeEach(async () => {
51-
id = await agent.post("/student/add").send({
51+
id = await agent.post("/student/create").send({
5252
ERPID: "S1032220999",
5353
name: "Arya",
5454
joiningYear: 2020,
@@ -83,10 +83,10 @@ describe("Student API", () => {
8383
it("should update student", async () => {
8484
const response = await agent
8585
.post(`/student/update/${id}`)
86-
.send({ joiningYear: 2020 });
86+
.send({ERPID: "S1032220999"},{ joiningYear: 2021 });
8787

8888
expect(response.status).toBe(200);
89-
expect(response.body.res).toMatch(/updated student/);
89+
expect(response.body.res).toMatch(`updated Student with id ${id}`);
9090
});
9191
});
9292
});

0 commit comments

Comments
 (0)