From 685d8105e491bb959b0d470f1d6d69422312b987 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Thu, 21 Sep 2023 12:12:34 +0530 Subject: [PATCH] chore: fixed issues with test cases in team-environment module --- .../team-environments/team-environments.service.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts b/packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts index 254936460..466dddf69 100644 --- a/packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts +++ b/packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts @@ -301,7 +301,7 @@ describe('TeamEnvironmentsService', () => { describe('createDuplicateEnvironment', () => { test('should successfully duplicate an existing team environment', async () => { - mockPrisma.teamEnvironment.findFirst.mockResolvedValueOnce( + mockPrisma.teamEnvironment.findFirstOrThrow.mockResolvedValueOnce( teamEnvironment, ); @@ -322,7 +322,9 @@ describe('TeamEnvironmentsService', () => { }); test('should throw TEAM_ENVIRONMMENT_NOT_FOUND if provided id is invalid', async () => { - mockPrisma.teamEnvironment.findFirst.mockRejectedValue('NotFoundError'); + mockPrisma.teamEnvironment.findFirstOrThrow.mockRejectedValue( + 'NotFoundError', + ); const result = await teamEnvironmentsService.createDuplicateEnvironment( teamEnvironment.id, @@ -332,7 +334,7 @@ describe('TeamEnvironmentsService', () => { }); test('should send pubsub message to "team_environment//created" if team environment is updated successfully', async () => { - mockPrisma.teamEnvironment.findFirst.mockResolvedValueOnce( + mockPrisma.teamEnvironment.findFirstOrThrow.mockResolvedValueOnce( teamEnvironment, );