Skip to content

Commit

Permalink
fix: timing dependency on test case (hoppscotch#3070)
Browse files Browse the repository at this point in the history
  • Loading branch information
mirarifhasan authored May 23, 2023
1 parent d6c8400 commit 1b413e2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,15 @@ describe('UserHistoryService', () => {
});
describe('removeRequestFromHistory', () => {
test('Should resolve right and delete request from users history', async () => {
const executedOn = new Date();

mockPrisma.userHistory.delete.mockResolvedValueOnce({
userUid: 'abc',
id: '1',
request: [{}],
responseMetadata: [{}],
reqType: ReqType.REST,
executedOn: new Date(),
executedOn: executedOn,
isStarred: false,
});

Expand All @@ -376,15 +378,15 @@ describe('UserHistoryService', () => {
request: JSON.stringify([{}]),
responseMetadata: JSON.stringify([{}]),
reqType: ReqType.REST,
executedOn: new Date(),
executedOn: executedOn,
isStarred: false,
};

return expect(
await userHistoryService.removeRequestFromHistory('abc', '1'),
).toEqualRight(userHistory);
});
test('Should resolve left and error out when req id is invalid ', async () => {
test('Should resolve left and error out when req id is invalid', async () => {
mockPrisma.userHistory.delete.mockResolvedValueOnce(null);

return expect(
Expand Down

0 comments on commit 1b413e2

Please sign in to comment.