Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/utils/formatUserDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export function formatUserDetails(userDetails: UserResponseType) {
const userFullName = `**Full Name :** ${userDetails.user?.first_name} ${userDetails.user?.last_name}`;
const discordJoinedAt = `**Joined Server on :** ${convertedTimestamp}`;
const userState = `**State :** ${userDetails.user?.state}`;
const userName = `**UserName :** ${userDetails.user?.username}`;
const userId = `**UserId :** ${userDetails.user?.id}`;

return `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}`;
return `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}\n${userName}\n${userId}`;
}
8 changes: 6 additions & 2 deletions tests/unit/utils/formatUserDetails.test.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Can you use dummy user data here

Copy link
Contributor Author

@PeeyushPrashant PeeyushPrashant Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I did so because the userFullName and userState also had dummy values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean change the username with a dummy value like john dow, or use Ankush data
as a user can remove from the RDS as Jyotsna is not on RDS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I have added dummy value now

Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ describe("formatUserDetails function", () => {
userResponse
)}`;
const userState = `**State :** ACTIVE`;
const userName = `**UserName :** sunny`;
const userId = `**UserId :** iODXB6ns8jaZB9p0XlBw`;

const expectedFormattedDetails = `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}`;
const expectedFormattedDetails = `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}\n${userName}\n${userId}`;
expect(formattedDetails).toEqual(expectedFormattedDetails);
});

Expand All @@ -35,7 +37,9 @@ describe("formatUserDetails function", () => {
userWithoutDiscordJoinedAtResponse
)}`;
const userState = `**State :** IDLE`;
const expectedFormattedDetails = `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}`;
const userName = `**UserName :** jyotsna`;
const userId = `**UserId :** DWcTUhbC5lRXfDjZRp06`;
const expectedFormattedDetails = `## User Details\n${userFullName}\n${discordJoinedAt}\n${userState}\n${userName}\n${userId}`;
expect(formattedDetails).toEqual(expectedFormattedDetails);
});
});
Loading