Skip to content

Commit 8a31cc4

Browse files
committed
fixed all eslint issues
1 parent 64620ec commit 8a31cc4

File tree

12 files changed

+29
-22
lines changed

12 files changed

+29
-22
lines changed

controller/accreditation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function addAccreditation(req, res) {
1010
try {
1111
// eslint-disable-next-line max-len
1212
const accreditation = await addNewAccreditation(name, agencyName, dateofAccreditation, dateofExpiry);
13-
res.json({ res: `added accreditation ${accreditation.name}`, id:accreditation.id });
13+
res.json({ res: `added accreditation ${accreditation.name}`, id: accreditation.id });
1414
} catch (error) {
1515
logger.error("Error while inserting", error);
1616
res.status(500);

controller/coursework.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async function addCoursework(req, res) {
1717
const newCoursework = await createCoursework({
1818
student, type, course, task, objectID, activity, marks,
1919
});
20-
res.json({ res: `Added Coursework with ID ${newCoursework.id}`, id: newCoursework.id});
20+
res.json({ res: `Added Coursework with ID ${newCoursework.id}`, id: newCoursework.id });
2121
} catch (error) {
2222
logger.error("Error while inserting Coursework", error);
2323
res.status(500);

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 infrastructure ${newInfrastructure.id}`, id:newInfrastructure.id });
12+
res.json({ res: `added infrastructure ${newInfrastructure.id}`, id: newInfrastructure.id });
1313
} catch (error) {
1414
logger.error("Error while inserting", error);
1515
res.status(500);

controller/module.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ async function addModule(req, res) {
1717
no, name, outcome, contents, hrsPerModule, cognitiveLevels,
1818
} = req.body;
1919
try {
20-
const newModule = await addNewModule(no, name, outcome, contents, hrsPerModule, cognitiveLevels);
20+
const newModule = await addNewModule(
21+
no,
22+
name,
23+
outcome,
24+
contents,
25+
hrsPerModule,
26+
cognitiveLevels,
27+
);
2128
res.json({ res: `added module ${newModule.name}` });
2229
} catch (error) {
2330
logger.error("Error while inserting", error);
@@ -27,5 +34,5 @@ async function addModule(req, res) {
2734
}
2835

2936
export default {
30-
showModule, addModule
37+
showModule, addModule,
3138
};

controller/organization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ async function addOrganization(req, res) {
99
} = req.body;
1010
try {
1111
const organization = await addNewOrganization(parent, startDate, name, accreditation);
12-
res.json({ res: `added organization${organization.name}`, id:organization.id });
12+
res.json({ res: `added organization${organization.name}`, id: organization.id });
1313
} catch (error) {
1414
logger.error("Error while inserting", error);
1515
res.status(500);

services/module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export async function addNewModule(no, name, outcome, contents, hrsPerModule, co
1717
return newModule;
1818
}
1919
throw new databaseError.DataEntryError("Add Module");
20-
}
20+
}

test/routes/accreditation.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe("checking accreditation functions", () => {
5252
dateofAccreditation: "2023-06-18T14:11:30Z",
5353
dateofExpiry: "2023-05-28T14:10:30Z",
5454
});
55-
id=JSON.parse(id.res.text).id
55+
id = JSON.parse(id.res.text).id;
5656
});
5757

5858
afterEach(async () => {
@@ -69,7 +69,7 @@ describe("checking accreditation functions", () => {
6969

7070
it("update accreditation", async () => {
7171
const response = await agent
72-
.post("/accreditation/update/"+id)
72+
.post(`/accreditation/update/${id}`)
7373
.send({ name: "xyz" }, { name: "123" });
7474
expect(response.headers["content-type"]).toMatch(/json/);
7575
expect(response.status).toBe(200);

test/routes/coursework.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe("Coursework API", () => {
6262
describe("after adding coursework", () => {
6363
let id;
6464
beforeEach(async () => {
65-
id=await agent.post("/coursework/add").send({
65+
id = await agent.post("/coursework/add").send({
6666
student: "64fc3c8bde9fa947ea1f412f",
6767
type: "onCampus",
6868
course: "64fc3c8bde9fa947ea1f412f",
@@ -71,7 +71,7 @@ describe("Coursework API", () => {
7171
activity: "64fc3c8bde9fa947ea1f412f",
7272
marks: 97,
7373
});
74-
id=JSON.parse(id.res.text).id
74+
id = JSON.parse(id.res.text).id;
7575
});
7676

7777
afterEach(async () => {
@@ -90,7 +90,7 @@ describe("Coursework API", () => {
9090

9191
it("should update coursework", async () => {
9292
const response = await agent
93-
.post("/coursework/update/"+id)
93+
.post(`/coursework/update/${id}`)
9494
.send({ student: "64fc3c8bde9fa947ea1f412f" });
9595

9696
expect(response.status).toBe(200);

test/routes/department.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe("Department CRUD", () => {
6565
describe("after adding department", () => {
6666
let id;
6767
beforeEach(async () => {
68-
id=await agent.post("/department/create").send(
68+
id = await agent.post("/department/create").send(
6969
{
7070
name: "Computer",
7171
acronym: "COMPS",
@@ -74,7 +74,7 @@ describe("Department CRUD", () => {
7474
infrastructures: [mongoose.Types.ObjectId("5f8778b54b553439ac49a03b")],
7575
},
7676
);
77-
id=JSON.parse(id.res.text).id
77+
id = JSON.parse(id.res.text).id;
7878
});
7979

8080
afterEach(async () => {
@@ -106,7 +106,7 @@ describe("Department CRUD", () => {
106106

107107
it("should update department", async () => {
108108
const response = await agent
109-
.post("/department/update/"+id)
109+
.post(`/department/update/${id}`)
110110
.send(
111111
{
112112
name: "Electronics",

test/routes/infrastructure.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ describe("Infrastructure API", () => {
5858
describe("after adding infrastructure", () => {
5959
let id;
6060
beforeEach(async () => {
61-
id=await agent.post("/infrastructure/add").send({
61+
id = await agent.post("/infrastructure/add").send({
6262
name: "Building A",
6363
type: "Office",
6464
wing: "East",
6565
floor: 3,
6666
capacity: 100,
6767
});
68-
id=JSON.parse(id.res.text).id
68+
id = JSON.parse(id.res.text).id;
6969
});
7070

7171
afterEach(async () => {
@@ -88,7 +88,7 @@ describe("Infrastructure API", () => {
8888

8989
it("should update infrastructure", async () => {
9090
const response = await agent
91-
.post("/infrastructure/update/"+id)
91+
.post(`/infrastructure/update/${id}`)
9292
.send({ name: "Building A" }, { capacity: 150 });
9393

9494
expect(response.status).toBe(200);

0 commit comments

Comments
 (0)