Newer
Older
import { FIRST_ARRAY_ELEMENT } from '@/constants/common';
import { PLUGINS_MOCK } from '@/models/mocks/pluginsMock';
import { render, screen } from '@testing-library/react';
import { LoadPlugin, Props } from './LoadPlugin.component';
const renderComponent = ({ plugin }: Props): void => {
render(<LoadPlugin plugin={plugin} />);
};
describe('LoadPlugin - component', () => {
describe('when always', () => {
const plugin = PLUGINS_MOCK[FIRST_ARRAY_ELEMENT];
it('renders plugin name', () => {
renderComponent({ plugin });
const title = screen.getByText(plugin.name);
expect(title).toBeInTheDocument();
});
it('renders plugin load button', () => {
renderComponent({ plugin });
const loadButton = screen.getByText('Load');
expect(loadButton.tagName).toBe('BUTTON');
expect(loadButton).toBeInTheDocument();
});
});
});