import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__testing_library_react__ from "@testing-library/react";
import * as __WEBPACK_EXTERNAL_MODULE_react_router_dom__ from "react-router-dom";
import * as __WEBPACK_EXTERNAL_MODULE__ResourceList_mjs__ from "./ResourceList.mjs";
describe('ResourceList', ()=>{
    afterEach(()=>{
        jest.clearAllMocks();
    });
    const columns = [
        {
            key: 'title',
            content: 'Title',
            width: '2fr'
        },
        {
            key: 'subtitle',
            content: 'Subtitle'
        }
    ];
    const rows = [
        {
            key: 'row1',
            id: 'r1',
            title: 'title-1',
            subtitle: 'subtitle-1',
            link: '/row1-link'
        },
        {
            key: 'row2',
            id: 'r2',
            title: 'title-2',
            subtitle: 'subtitle-2'
        },
        {
            key: 'row3',
            id: 'r3',
            title: 'title-3',
            subtitle: 'subtitle-3'
        },
        {
            key: 'row4',
            id: 'r4',
            title: 'title-4',
            subtitle: 'subtitle-4'
        }
    ];
    test('should render list of items and row data, without displaying the key field', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__testing_library_react__.render)(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.MemoryRouter, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE__ResourceList_mjs__["default"], {
            columns: columns,
            rows: rows
        })));
        rows.map((item)=>{
            expect(__WEBPACK_EXTERNAL_MODULE__testing_library_react__.screen.queryByText(item.key)).toBeNull();
            expect(__WEBPACK_EXTERNAL_MODULE__testing_library_react__.screen.queryByText(item.id)).toBeNull();
            expect(__WEBPACK_EXTERNAL_MODULE__testing_library_react__.screen.queryByText(item.title)).toBeVisible();
            expect(__WEBPACK_EXTERNAL_MODULE__testing_library_react__.screen.queryByText(item.subtitle)).toBeVisible();
        });
    });
    test('should only show row as linked if `link` key is present in row data', ()=>{
        (0, __WEBPACK_EXTERNAL_MODULE__testing_library_react__.render)(/*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE_react_router_dom__.MemoryRouter, null, /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createElement(__WEBPACK_EXTERNAL_MODULE__ResourceList_mjs__["default"], {
            columns: columns,
            rows: rows
        })));
        rows.map((item)=>{
            const link = __WEBPACK_EXTERNAL_MODULE__testing_library_react__.screen.queryByTestId(`${item.key}-link`);
            if (item.link) expect(link).toBeInTheDocument();
            else expect(link).not.toBeInTheDocument();
        });
    });
});
