import React from 'react';
import { render, screen } from '@testing-library/react';
import { READABLE_QUERY_PRIMITIVE_TYPES } from '@reltio/mdm-sdk';
import { ReadableSearchQuery } from './ReadableSearchQuery';
describe('ReadableSearchQuery tests', function () {
    it('should render empty string if readableQuery is empty', function () {
        var container = render(React.createElement(ReadableSearchQuery, null)).container;
        expect(container).toHaveTextContent('');
    });
    it('should render query', function () {
        var readableQuery = [
            { text: 'REGISTRY: ', type: 'entityTypeLabel' },
            { text: 'Name', type: 'attributeLabel' },
            { text: ' ', type: 'space' },
            { text: '≠', type: 'attributeFilter' },
            { text: ' ', type: 'space' },
            { text: '"John"', type: 'attributeValue' }
        ];
        var container = render(React.createElement(ReadableSearchQuery, { readableQuery: readableQuery })).container;
        expect(container).toHaveTextContent('REGISTRY: Name ≠ "John"');
        expect(screen.getByText('REGISTRY:')).toHaveClass(READABLE_QUERY_PRIMITIVE_TYPES.entityTypeLabel);
        expect(screen.getByText('Name')).toHaveClass(READABLE_QUERY_PRIMITIVE_TYPES.attributeLabel);
        expect(screen.getByText('≠')).toHaveClass(READABLE_QUERY_PRIMITIVE_TYPES.attributeFilter);
        expect(screen.getByText('"John"')).toHaveClass(READABLE_QUERY_PRIMITIVE_TYPES.attributeValue);
    });
});
