From 0ccd7c80189b29d23544062cc081fd025ff082e6 Mon Sep 17 00:00:00 2001 From: kennsippell Date: Fri, 20 Dec 2024 12:30:18 -0700 Subject: [PATCH] Simplified success messaging --- src/lib/manage-hierarchy.ts | 4 ---- src/routes/manage-hierarchy.ts | 4 ++-- test/lib/manage-hierarchy.spec.ts | 8 -------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/lib/manage-hierarchy.ts b/src/lib/manage-hierarchy.ts index 77e57fe..daf9aca 100644 --- a/src/lib/manage-hierarchy.ts +++ b/src/lib/manage-hierarchy.ts @@ -29,10 +29,6 @@ export default class ManageHierarchyLib { public static async scheduleJob(job: JobParams, queueName: IQueue = getChtConfQueue()) { await queueName.add(job); - - return { - success: true - }; } public static parseHierarchyAction(action: string = ''): HierarchyAction { diff --git a/src/routes/manage-hierarchy.ts b/src/routes/manage-hierarchy.ts index 68e7ff4..80e98af 100644 --- a/src/routes/manage-hierarchy.ts +++ b/src/routes/manage-hierarchy.ts @@ -46,8 +46,8 @@ export default async function sessionCache(fastify: FastifyInstance) { const isConfirmed = formData.confirmed === 'true'; const job = await ManageHierarchyLib.getJobDetails(formData, contactType, sessionCache, chtApi); if (isConfirmed) { - const result = await ManageHierarchyLib.scheduleJob(job); - tmplData.success = result.success; + await ManageHierarchyLib.scheduleJob(job); + tmplData.success = true; } else { const warningInfo = await ManageHierarchyLib.getWarningInfo(job, chtApi); tmplData.warningInfo = warningInfo; diff --git a/test/lib/manage-hierarchy.spec.ts b/test/lib/manage-hierarchy.spec.ts index 3c32ab4..b6b9b8a 100644 --- a/test/lib/manage-hierarchy.spec.ts +++ b/test/lib/manage-hierarchy.spec.ts @@ -58,11 +58,6 @@ describe('lib/manage-hierarchy.ts', () => { instanceUrl: 'http://domain.com', sessionToken: 'encoded-token', }); - - const actual = await ManageHierarchyLib.scheduleJob(jobParams, chtConfQueue); - - // Verify the data passed to mockmoveContactQueue - expect(chtConfQueue.add.calledOnce).to.be.true; }); it('move CHU: subcounty required', async () => { @@ -128,9 +123,6 @@ describe('lib/manage-hierarchy.ts', () => { instanceUrl: 'http://domain.com', sessionToken: 'encoded-token', }); - - await ManageHierarchyLib.scheduleJob(jobParams, chtConfQueue); - expect(chtConfQueue.add.calledOnce).to.be.true; }); });