Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: removed all instances of `rejectOnNotFound` in prisma queries (#3377)
Balu Babu46caf9b198b7
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.tsindex 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/<teamID>/created" if team environment is updated successfully', async () => {- mockPrisma.teamEnvironment.findFirst.mockResolvedValueOnce(+ mockPrisma.teamEnvironment.findFirstOrThrow.mockResolvedValueOnce(teamEnvironment,);diff --git a/packages/hoppscotch-backend/src/team-environments/team-environments.service.ts b/packages/hoppscotch-backend/src/team-environments/team-environments.service.tsindex d50a62a11..7af9481e5 100644--- a/packages/hoppscotch-backend/src/team-environments/team-environments.service.ts+++ b/packages/hoppscotch-backend/src/team-environments/team-environments.service.ts@@ -183,11 +183,10 @@ export class TeamEnvironmentsService {*/async createDuplicateEnvironment(id: string) {try {- const environment = await this.prisma.teamEnvironment.findFirst({+ const environment = await this.prisma.teamEnvironment.findFirstOrThrow({where: {id: id,},- rejectOnNotFound: true,});const result = await this.prisma.teamEnvironment.create({