diff --git a/controller/module.js b/controller/module.js index e362043..1a4fd49 100644 --- a/controller/module.js +++ b/controller/module.js @@ -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); diff --git a/services/module.js b/services/module.js index e81bb56..7411b15 100644 --- a/services/module.js +++ b/services/module.js @@ -8,7 +8,3 @@ export async function getModule(filter) { } throw new databaseError.DataNotFoundError("Module"); } - -export default { - getModule, -}; diff --git a/test/routes/module.test.js b/test/routes/module.test.js index 7eb5e2d..3228b4e 100644 --- a/test/routes/module.test.js +++ b/test/routes/module.test.js @@ -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(); @@ -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); });