bigbuffet-rw/app/soapbox/components/ui/emoji/__tests__/emoji.test.tsx

24 lines
710 B
TypeScript
Raw Normal View History

import * as React from 'react';
2022-04-05 08:03:57 -07:00
import { render, screen } from '../../../../jest/test-helpers';
import Emoji from '../emoji';
describe('<Emoji />', () => {
it('renders a simple emoji', () => {
render(<Emoji emoji='😀' />);
2022-04-05 08:03:57 -07:00
const img = screen.getByRole('img');
expect(img.getAttribute('src')).toBe('/packs/emoji/1f600.svg');
expect(img.getAttribute('alt')).toBe('😀');
});
// https://emojipedia.org/emoji-flag-sequence/
it('renders a sequence emoji', () => {
render(<Emoji emoji='🇺🇸' />);
const img = screen.getByRole('img');
expect(img.getAttribute('src')).toBe('/packs/emoji/1f1fa-1f1f8.svg');
expect(img.getAttribute('alt')).toBe('🇺🇸');
2022-04-05 08:03:57 -07:00
});
});