Skip to content

Commit

Permalink
Refactor GET endpoint /module/list
Browse files Browse the repository at this point in the history
  • Loading branch information
sumitst05 committed Sep 2, 2023
1 parent bc39741 commit 4d6fa71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions controller/module.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import getModules from "#services/module";
import { getModule } from "#services/module";
import { logger } from "#util";

async function showModule(req, res) {
try {
const modules = await getModules(req.query);
const modules = await getModule(req.query);
return res.json({ res: modules });
} catch (error) {
logger.error("Error while fetching", error);
Expand Down
4 changes: 0 additions & 4 deletions services/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@ export async function getModule(filter) {
}
throw new databaseError.DataNotFoundError("Module");
}

export default {
getModule,
};
6 changes: 3 additions & 3 deletions test/routes/module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.mock("#util");
let server;
let agent;
beforeAll((done) => {
server = app.listen(3000, () => {
server = app.listen(null, () => {
agent = request.agent(server);
connector.set("debug", false);
done();
Expand All @@ -30,9 +30,9 @@ afterAll((done) => {
});

describe("checking accreditation functions", () => {
it("read accreditation", async () => {
it("read module", async () => {
const response = await agent
.get("/accreditation/list")
.get("/module/list")
.send({ name: "xyz" });
expect(response.status).toBe(200);
});
Expand Down

0 comments on commit 4d6fa71

Please sign in to comment.