From deb03c09fa8d89f6998db6365f4911064092d6a8 Mon Sep 17 00:00:00 2001 From: williams-jack Date: Wed, 7 Aug 2024 22:17:44 -0400 Subject: [PATCH] fix: incorrect test mock --- .../db/src/server-operations/__tests__/get-jobs.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/orchestrator/packages/db/src/server-operations/__tests__/get-jobs.test.ts b/orchestrator/packages/db/src/server-operations/__tests__/get-jobs.test.ts index 9939d807..5e289d48 100644 --- a/orchestrator/packages/db/src/server-operations/__tests__/get-jobs.test.ts +++ b/orchestrator/packages/db/src/server-operations/__tests__/get-jobs.test.ts @@ -19,7 +19,11 @@ describe('get all grading jobs in the queue', () => { const configs = generateJobConfigs(2); const queueInfos = generateMultipleMockQueueInfos(configs, true); mockPrismaInstance.reservation.findMany.mockResolvedValue(queueInfos.map((q) => ({ ...q.reservation, job: q.job }))); - mockPrismaInstance.job.findMany.mockResolvedValue(queueInfos.map((q) => q.job)); + // the getAllGradingJobs function only calls job.findMany with a list of + // submitter IDs from the provided reservations. These are all immediate + // jobs in this case, meaning that there would be _zero_ reservations with + // submitter IDs on these reservations. + mockPrismaInstance.job.findMany.mockResolvedValue([]); await expect(getAllGradingJobs().then((jobs) => jobs.map((j) => j.key))).resolves.toEqual(configs.map((c) => c.key)); }); it('returns both submitter and immediate jobs in order of release at', async () => {