Skip to content

Commit

Permalink
Added tests for the file src/resolvers/Mutation/updateUserProfile.ts (#…
Browse files Browse the repository at this point in the history
…1861)

* Added tests

* Added tests

---------

Co-authored-by: Siddhesh Bhupendra Kuakde <littlelord124@gmail.com>
  • Loading branch information
Anvita0305 and SiddheshKukade authored Feb 18, 2024
1 parent 2e2bc0d commit 7bbbfa0
Show file tree
Hide file tree
Showing 2 changed files with 368 additions and 65 deletions.
12 changes: 8 additions & 4 deletions src/resolvers/Mutation/updateUserProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const updateUserProfile: MutationResolvers["updateUserProfile"] = async (
}

// Update User
const updatedUser = await User.findOneAndUpdate(
let updatedUser = await User.findOneAndUpdate(
{
_id: context.userId,
},
Expand Down Expand Up @@ -128,9 +128,13 @@ export const updateUserProfile: MutationResolvers["updateUserProfile"] = async (
runValidators: true,
},
).lean();
updatedUser!.image = updatedUser?.image
? `${context.apiRootUrl}${updatedUser?.image}`
: null;

if (updatedUser != null) {
updatedUser.image = updatedUser?.image
? `${context.apiRootUrl}${updatedUser?.image}`
: null;
}
if (args.data == undefined) updatedUser = null;

return updatedUser ?? ({} as InterfaceUser);
};
Loading

0 comments on commit 7bbbfa0

Please sign in to comment.