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
HBE-270 Test-Case timestamp issue fix in backend (#3415)
Mir Arif Hasan8deb6471b9f8
diff --git a/packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts b/packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.tsindex c9367b0f0..076c30408 100644--- a/packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts+++ b/packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts@@ -1,5 +1,5 @@import { Team, TeamCollection as DBTeamCollection } from '@prisma/client';-import { mock, mockDeep, mockReset } from 'jest-mock-extended';+import { mockDeep, mockReset } from 'jest-mock-extended';import {TEAM_COLL_DEST_SAME,TEAM_COLL_INVALID_JSON,@@ -17,9 +17,6 @@ import { PrismaService } from 'src/prisma/prisma.service';import { PubSubService } from 'src/pubsub/pubsub.service';import { AuthUser } from 'src/types/AuthUser';import { TeamCollectionService } from './team-collection.service';-import { TeamCollection } from './team-collection.model';-import { TeamCollectionModule } from './team-collection.module';-import * as E from 'fp-ts/Either';const mockPrisma = mockDeep<PrismaService>();const mockPubSub = mockDeep<PubSubService>();diff --git a/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts b/packages/hoppscotch-backend/src/user-history/user-history.service.spec.tsindex 69314717a..e53563926 100644--- a/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts+++ b/packages/hoppscotch-backend/src/user-history/user-history.service.spec.ts@@ -142,13 +142,15 @@ describe('UserHistoryService', () => {});describe('createUserHistory', () => {test('Should resolve right and create a REST request to users history and return a `UserHistory` object', async () => {+ const executedOn = new Date();+mockPrisma.userHistory.create.mockResolvedValueOnce({userUid: 'abc',id: '1',request: [{}],responseMetadata: [{}],reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: false,});@@ -158,7 +160,7 @@ describe('UserHistoryService', () => {request: JSON.stringify([{}]),responseMetadata: JSON.stringify([{}]),reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: false,};@@ -172,13 +174,15 @@ describe('UserHistoryService', () => {).toEqualRight(userHistory);});test('Should resolve right and create a GQL request to users history and return a `UserHistory` object', async () => {+ const executedOn = new Date();+mockPrisma.userHistory.create.mockResolvedValueOnce({userUid: 'abc',id: '1',request: [{}],responseMetadata: [{}],reqType: ReqType.GQL,- executedOn: new Date(),+ executedOn,isStarred: false,});@@ -188,7 +192,7 @@ describe('UserHistoryService', () => {request: JSON.stringify([{}]),responseMetadata: JSON.stringify([{}]),reqType: ReqType.GQL,- executedOn: new Date(),+ executedOn,isStarred: false,};@@ -212,13 +216,15 @@ describe('UserHistoryService', () => {).toEqualLeft(USER_HISTORY_INVALID_REQ_TYPE);});test('Should create a GQL request to users history and publish a created subscription', async () => {+ const executedOn = new Date();+mockPrisma.userHistory.create.mockResolvedValueOnce({userUid: 'abc',id: '1',request: [{}],responseMetadata: [{}],reqType: ReqType.GQL,- executedOn: new Date(),+ executedOn,isStarred: false,});@@ -228,7 +234,7 @@ describe('UserHistoryService', () => {request: JSON.stringify([{}]),responseMetadata: JSON.stringify([{}]),reqType: ReqType.GQL,- executedOn: new Date(),+ executedOn,isStarred: false,};@@ -245,13 +251,15 @@ describe('UserHistoryService', () => {);});test('Should create a REST request to users history and publish a created subscription', async () => {+ const executedOn = new Date();+mockPrisma.userHistory.create.mockResolvedValueOnce({userUid: 'abc',id: '1',request: [{}],responseMetadata: [{}],reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: false,});@@ -261,7 +269,7 @@ describe('UserHistoryService', () => {request: JSON.stringify([{}]),responseMetadata: JSON.stringify([{}]),reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: false,};@@ -323,13 +331,15 @@ describe('UserHistoryService', () => {).toEqualLeft(USER_HISTORY_NOT_FOUND);});test('Should star/unstar a request in the history and publish a updated subscription', async () => {+ const executedOn = new Date();+mockPrisma.userHistory.findFirst.mockResolvedValueOnce({userUid: 'abc',id: '1',request: [{}],responseMetadata: [{}],reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: false,});@@ -339,7 +349,7 @@ describe('UserHistoryService', () => {request: [{}],responseMetadata: [{}],reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: true,});@@ -349,7 +359,7 @@ describe('UserHistoryService', () => {request: JSON.stringify([{}]),responseMetadata: JSON.stringify([{}]),reqType: ReqType.REST,- executedOn: new Date(),+ executedOn,isStarred: true,};