import React from 'react';
import { render, screen } from '@testing-library/react';
import { DataTypes } from '@reltio/mdm-sdk';
import { buildColumnsFilter, defaultRenderRowCell } from './basicTable';
describe('basicTable tests', function () {
    describe('defaultRenderRowCell', function () {
        it('should call CellValueRenderer with all cell values', function () {
            var DefaultCell = defaultRenderRowCell;
            var values = [1, 2, 3];
            var CellValueRenderer = function (_a) {
                var value = _a.value;
                return React.createElement("div", { "data-reltio-id": "cell" }, value);
            };
            render(React.createElement(DefaultCell, { cell: { values: values }, CellValueRenderer: CellValueRenderer }));
            expect(screen.getAllByTestId('cell')).toHaveLength(values.length);
            values.forEach(function (value) {
                expect(screen.getByText(value)).toBeInTheDocument();
            });
        });
    });
    describe('buildColumnsFilter tests', function () {
        var filters = {
            label: { filter: 'equals', value: '123' },
            directional: { filter: 'before', value: 852145200000 }
        };
        var columnsData = [
            { id: 'label', label: 'Label', dataTypeDefinition: { type: DataTypes.TYPE_STRING } },
            { id: 'type', label: 'Type', dataTypeDefinition: { type: DataTypes.TYPE_STRING } },
            { id: 'directional', label: 'Directional Label', dataTypeDefinition: { type: DataTypes.TYPE_DATE } }
        ];
        it('should return correct filter string', function () {
            expect(buildColumnsFilter(columnsData, filters)).toBe("equals(label,'123') and lte(directional,'852163199999')");
        });
    });
});
