import React from 'react';
import { renderInAppContext } from '@theorchard/suite-testing';
import Basics, { Props, CLASSNAME } from '../basics';

describe('<Bacisc>', () => {
    const defaultProps: Props = {
        data: {
            vendorId: 1,
            uuid: '1',
            name: 'name',
            isDistributor: true,
            defaultSalesSheetTemplateId: 'ID',
        },
    };

    const renderWrapper = (props?: Partial<Props>) =>
        renderInAppContext(<Basics {...defaultProps} {...props} />);

    test('renders default component', () => {
        const { getByTestId } = renderWrapper();

        expect(getByTestId(CLASSNAME)).toBeVisible();
    });

    test('renders sections', () => {
        const { getAllByTestId } = renderWrapper();
        const sections = getAllByTestId('SuiteSection');

        sections.forEach(section => {
            expect(section).toBeVisible();
        });

        expect(sections).toHaveLength(3);
    });
});
