1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import {render, screen} from 'sentry-test/reactTestingLibrary';
- import {
- FilterType,
- ParseResult,
- TermOperator,
- Token,
- TokenResult,
- } from 'sentry/components/searchSyntax/parser';
- import HighlightQuery from './renderer';
- const query: ParseResult = [
- {
- type: Token.FILTER,
- filter: FilterType.TEXT,
- negated: false,
- key: {
- type: Token.KEY_SIMPLE,
- value: 'user.email',
- quoted: false,
- text: 'user.email',
- location: {
- start: {offset: 0, line: 1, column: 1},
- end: {offset: 10, line: 1, column: 11},
- },
- },
- operator: TermOperator.DEFAULT,
- value: {
- type: Token.VALUE_TEXT,
- value: 'foo@example.com',
- quoted: false,
- text: 'foo@example.com',
- location: {
- start: {offset: 11, line: 1, column: 12},
- end: {offset: 27, line: 1, column: 28},
- },
- },
- invalid: null,
- warning: null,
- text: 'user.email:foo@example.com',
- location: {
- start: {offset: 0, line: 1, column: 1},
- end: {offset: 27, line: 1, column: 28},
- },
- } satisfies TokenResult<Token.FILTER>,
- ];
- describe('SmartSearchBar', function () {
- it('renders the query', function () {
- render(<HighlightQuery parsedQuery={query} cursorPosition={-1} />);
- expect(screen.getByText('user.email:')).toBeInTheDocument();
- expect(screen.getByText('foo@example.com')).toBeInTheDocument();
- });
- });
|