Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Kumar <[email protected]>
  • Loading branch information
abhinavkrin committed Nov 6, 2024
1 parent 464a161 commit fae142f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion apps/meteor/client/views/admin/customEmoji/CustomEmoji.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('CustomEmoji Component', () => {
});
});

it("renders emoji's aliases as comma-separated values", async () => {
it("renders emoji's aliases as comma-separated values when aliases is an array", async () => {
render(<CustomEmoji onClick={mockOnClick} reload={mockRef} />, {
legacyRoot: true,
wrapper: appRoot.build(),
Expand All @@ -48,4 +48,32 @@ describe('CustomEmoji Component', () => {
expect(screen.getByText('happy, joy')).toBeInTheDocument();
});
});

it("renders emoji's aliases values when aliases is a string", async () => {
render(<CustomEmoji onClick={mockOnClick} reload={mockRef} />, {
legacyRoot: true,
wrapper: mockAppRoot()
.withEndpoint('GET', '/v1/emoji-custom.all', () => ({
count: 1,
offset: 0,
total: 1,
success: true,
emojis: [
{
_id: '1',
name: 'smile',
aliases: 'happy' as any,
extension: 'webp',
_updatedAt: new Date().toISOString(),
etag: 'abcdef',
},
],
}))
.build(),
});

await waitFor(() => {
expect(screen.getByText('happy')).toBeInTheDocument();
});
});
});

0 comments on commit fae142f

Please sign in to comment.