import ProductPartsList from './index';
import mountWithState from 'Utils/Test/mountWithState';

describe('Modules/Creator/Containers/ProductPartsList', () => {
    it('removes hidden components', () => {
        const state = {
            configurator: {
                filteredOptionclassifications: [
                    { identifier: 'door' },
                    { identifier: 'ventilator' },
                    { identifier: 'drawer' },
                    { identifier: 'racks' },
                    { identifier: 'doorrack' },
                    { identifier: 'addons' },
                    { identifier: 'hidden_addons', hiddenInFrontend: true },
                ],
                selectedoptionclassification: {},
            },
            ui: {
                visibilityMap: {},
            },
            device: {
                screen: {
                    orientation: 'landscape',
                },
            },
        };
        const ProductPartListComponent = () => null;
        const { wrapper } = mountWithState(ProductPartsList, state, { Component: ProductPartListComponent });

        const expectedOptionclassifications = [
            { identifier: 'door' },
            { identifier: 'ventilator' },
            { identifier: 'drawer' },
            { identifier: 'racks' },
            { identifier: 'doorrack' },
            { identifier: 'addons' },
        ];

        expect(wrapper.find(ProductPartListComponent).prop('optionclassifications')).toEqual(
            expectedOptionclassifications
        );
    });
});
