Skip to content

Commit 8c8e317

Browse files
Merge branch 'development' of https://github.com/tcet-opensource/erp-backend into 291-student-model-curd
2 parents 101911a + b0b8644 commit 8c8e317

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

controller/infrastructure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function addInfrastructure(req, res) {
99
} = req.body;
1010
try {
1111
const newInfrastructure = await createInfrastructure(name, type, wing, floor, capacity);
12-
res.json({ res: `added user ${newInfrastructure.id}` });
12+
res.json({ res: `added infrastructure ${newInfrastructure.id}` });
1313
} catch (error) {
1414
logger.error("Error while inserting", error);
1515
res.status(500);

services/accreditation.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,3 @@ export async function updateAccreditationById(id, data) {
3737
}
3838
throw new databaseError.DataEntryError("Accrediation");
3939
}
40-
41-
export default {
42-
deleteAccreditationById, addNewAccreditation, updateAccreditationById,
43-
};

test/routes/accreditation.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jest.mock("#util");
99
let server;
1010
let agent;
1111
beforeAll((done) => {
12-
server = app.listen(5000, () => {
12+
server = app.listen(null, () => {
1313
agent = request.agent(server);
1414
connector.set("debug", false);
1515
done();
@@ -60,9 +60,10 @@ describe("checking accreditation functions", () => {
6060

6161
it("read accreditation", async () => {
6262
const response = await agent
63-
.post("/accreditation/list")
63+
.get("/accreditation/list")
6464
.send({ name: "xyz" });
65-
expect(response.body.res).not.toBeNull();
65+
expect(response.status).toBe(200);
66+
expect(response.body.res).toBeDefined();
6667
});
6768

6869
it("update accreditation", async () => {

test/routes/auth.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jest.mock("#util");
1010
let server;
1111
let agent;
1212
beforeAll((done) => {
13-
server = app.listen(3500, () => {
13+
server = app.listen(null, () => {
1414
agent = request.agent(server);
1515
connector.set("debug", false);
1616
done();

test/routes/infrastructure.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let server;
1010
let agent;
1111

1212
beforeAll((done) => {
13-
server = app.listen(5000, () => {
13+
server = app.listen(null, () => {
1414
agent = request.agent(server);
1515
connector.set("debug", false);
1616
done();
@@ -52,7 +52,7 @@ describe("Infrastructure API", () => {
5252
});
5353

5454
expect(response.status).toBe(200);
55-
expect(response.body.res).toMatch(/added user/);
55+
expect(response.body.res).toMatch(/added infrastructure/);
5656
});
5757

5858
describe("after adding infrastructure", () => {
@@ -78,9 +78,10 @@ describe("Infrastructure API", () => {
7878

7979
it("should read infrastructure", async () => {
8080
const response = await agent
81-
.post("/infrastructure/list")
81+
.get("/infrastructure/list")
8282
.send({ name: "Building A" });
83-
expect(response.body.res).not.toBeNull();
83+
expect(response.status).toBe(200);
84+
expect(response.body.res).toBeDefined();
8485
});
8586

8687
it("should update infrastructure", async () => {

0 commit comments

Comments
 (0)