bigbuffet-rw/app/soapbox/components/__tests__/autosuggest_emoji.test.js

33 lines
931 B
JavaScript
Raw Normal View History

2020-03-27 13:59:38 -07:00
import React from 'react';
import { render, screen } from '../../jest/test-helpers';
2020-03-27 13:59:38 -07:00
import AutosuggestEmoji from '../autosuggest_emoji';
describe('<AutosuggestEmoji />', () => {
it('renders native emoji', () => {
const emoji = {
native: '💙',
colons: ':foobar:',
};
render(<AutosuggestEmoji emoji={emoji} />);
expect(screen.getByTestId('emoji')).toHaveTextContent('foobar');
expect(screen.getByRole('img').getAttribute('src')).not.toBe('http://example.com/emoji.png');
2020-03-27 13:59:38 -07:00
});
it('renders emoji with custom url', () => {
const emoji = {
custom: true,
imageUrl: 'http://example.com/emoji.png',
native: 'foobar',
colons: ':foobar:',
};
render(<AutosuggestEmoji emoji={emoji} />);
expect(screen.getByTestId('emoji')).toHaveTextContent('foobar');
expect(screen.getByRole('img').getAttribute('src')).toBe('http://example.com/emoji.png');
2020-03-27 13:59:38 -07:00
});
});