Skip to content

Commit

Permalink
Update test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedNufais5891 authored Dec 31, 2024
1 parent ae9480a commit 3aad355
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions backend/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,22 @@ describe("Student Endpoints", () => {
const res = await requestWithSupertest.get("/listStudents");
expect(res.status).toEqual(200);
let body = res.body;
expect(body.length).toEqual(1);
body.forEach(element => {
expect(element).toHaveProperty('age');
expect(element).toHaveProperty('name');
expect(element).toHaveProperty('id');
expect(element).toHaveProperty('hometown');
});
expect(body.length).toBe(1);

expect(body).toContainEqual({
"age": 12,
"name": "Rashini Shehara",
"id": 99999,
"hometown":"Galle",
});

expect(body[1].name).toBe('Rashini Shehara');

});

if("POST /addStudent should show a newly added student", async () => {
// add new student
Expand Down

0 comments on commit 3aad355

Please sign in to comment.