Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Kumar <[email protected]>
  • Loading branch information
abhinavkrin committed Oct 28, 2024
1 parent 2a5fdf3 commit 82f9d85
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/meteor/app/emoji-custom/client/lib/emojiCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const updateEmojiCustom = (emojiData: IEmoji) => {
}

if (previousExists) {
replaceEmojiInRecent(emojiData.previousName, emojiData.name);
replaceEmojiInRecent({ oldEmoji: emojiData.previousName, newEmoji: emojiData.name });
}
};

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/emoji/client/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const updateRecent = (recentList: string[]) => {
});
};

export const replaceEmojiInRecent = (oldEmoji: string, newEmoji: string) => {
export const replaceEmojiInRecent = ({ oldEmoji, newEmoji }: { oldEmoji: string; newEmoji: string }) => {
const recentPkgList: string[] = emoji.packages.base.emojisByCategory.recent;
const pos = recentPkgList.indexOf(oldEmoji);

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/unit/app/emoji/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ describe('Emoji Client Helpers', () => {
describe('replaceEmojiInRecent', () => {
it('should replace an existing emoji with a new one in recent emojis', () => {
emoji.packages.base.emojisByCategory.recent = ['emoji1', 'emoji2', 'emoji3'];
replaceEmojiInRecent('emoji2', 'emoji4');
replaceEmojiInRecent({ oldEmoji: 'emoji2', newEmoji: 'emoji4' });
expect(emoji.packages.base.emojisByCategory.recent).to.not.include('emoji2');
expect(emoji.packages.base.emojisByCategory.recent).to.include('emoji4');
expect(emoji.packages.base.emojisByCategory.recent).to.deep.equal(['emoji1', 'emoji4', 'emoji3']);
});

it('should do nothing if the emoji to replace is not in the recent list', () => {
emoji.packages.base.emojisByCategory.recent = ['emoji1', 'emoji2'];
replaceEmojiInRecent('emoji3', 'emoji4');
replaceEmojiInRecent({ oldEmoji: 'emoji3', newEmoji: 'emoji4' });
expect(emoji.packages.base.emojisByCategory.recent).to.deep.equal(['emoji1', 'emoji2']);
});
});
Expand Down

0 comments on commit 82f9d85

Please sign in to comment.