refactor: changed the test cases to reflect change to UserHistory schema

This commit is contained in:
Balu Babu
2023-01-24 02:02:17 +05:30
parent 4023dcf09d
commit 73ace77305
4 changed files with 30 additions and 33 deletions

View File

@@ -25,7 +25,7 @@ export class UserHistoryService {
const userHistory = await this.prisma.userHistory.findMany({
where: {
userUid: uid,
type: reqType,
reqType: reqType,
},
});
@@ -33,7 +33,6 @@ export class UserHistoryService {
(history) =>
<UserHistory>{
...history,
reqType: history.type,
request: JSON.stringify(history.request),
responseMetadata: JSON.stringify(history.responseMetadata),
},
@@ -64,14 +63,13 @@ export class UserHistoryService {
userUid: uid,
request: JSON.parse(reqData),
responseMetadata: JSON.parse(resMetadata),
type: requestType.right,
reqType: requestType.right,
isStarred: false,
},
});
const userHistory = <UserHistory>{
...history,
reqType: history.type,
request: JSON.stringify(history.request),
responseMetadata: JSON.stringify(history.responseMetadata),
};
@@ -113,7 +111,6 @@ export class UserHistoryService {
const updatedUserHistory = <UserHistory>{
...updatedHistory,
reqType: updatedHistory.type,
request: JSON.stringify(updatedHistory.request),
responseMetadata: JSON.stringify(updatedHistory.responseMetadata),
};
@@ -145,7 +142,6 @@ export class UserHistoryService {
const deletedUserHistory = <UserHistory>{
...delUserHistory,
reqType: delUserHistory.type,
request: JSON.stringify(delUserHistory.request),
responseMetadata: JSON.stringify(delUserHistory.responseMetadata),
};
@@ -174,7 +170,7 @@ export class UserHistoryService {
const deletedCount = await this.prisma.userHistory.deleteMany({
where: {
userUid: uid,
type: requestType.right,
reqType: requestType.right,
},
});