mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-12 17:26:43 +00:00
parent
227d81951c
commit
f8922e97a6
@ -11,7 +11,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { findByText, getByTestId, render } from '@testing-library/react';
|
import {
|
||||||
|
findByText,
|
||||||
|
getByTestId,
|
||||||
|
queryByTestId,
|
||||||
|
render,
|
||||||
|
} from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
import { MemoryRouter } from 'react-router-dom';
|
||||||
import QueryCard from './QueryCard';
|
import QueryCard from './QueryCard';
|
||||||
@ -54,4 +59,28 @@ describe('Test QueryCard Component', () => {
|
|||||||
expect(query).toBeInTheDocument();
|
expect(query).toBeInTheDocument();
|
||||||
expect(copyQueryButton).toBeInTheDocument();
|
expect(copyQueryButton).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should not render header if user is undefined', async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<QueryCard query={{ ...mockQueryData, user: undefined }} />,
|
||||||
|
{
|
||||||
|
wrapper: MemoryRouter,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const queryHeader = queryByTestId(container, 'query-header');
|
||||||
|
|
||||||
|
expect(queryHeader).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not render header if duration is undefined', async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<QueryCard query={{ ...mockQueryData, duration: undefined }} />,
|
||||||
|
{
|
||||||
|
wrapper: MemoryRouter,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const queryHeader = queryByTestId(container, 'query-header');
|
||||||
|
|
||||||
|
expect(queryHeader).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import { isUndefined } from 'lodash';
|
||||||
import React, { FC, HTMLAttributes, useState } from 'react';
|
import React, { FC, HTMLAttributes, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { getUserPath } from '../../constants/constants';
|
import { getUserPath } from '../../constants/constants';
|
||||||
@ -31,6 +32,7 @@ const QueryCard: FC<QueryCardProp> = ({ className, query }) => {
|
|||||||
<div
|
<div
|
||||||
className="tw-cursor-pointer"
|
className="tw-cursor-pointer"
|
||||||
onClick={() => setExpanded((pre) => !pre)}>
|
onClick={() => setExpanded((pre) => !pre)}>
|
||||||
|
{!isUndefined(query.user) && !isUndefined(query.duration) ? (
|
||||||
<div
|
<div
|
||||||
className="tw-flex tw-py-1 tw-justify-between"
|
className="tw-flex tw-py-1 tw-justify-between"
|
||||||
data-testid="query-header">
|
data-testid="query-header">
|
||||||
@ -65,6 +67,7 @@ const QueryCard: FC<QueryCardProp> = ({ className, query }) => {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="tw-border tw-border-main tw-rounded-md tw-p-px">
|
<div className="tw-border tw-border-main tw-rounded-md tw-p-px">
|
||||||
<div
|
<div
|
||||||
|
@ -891,6 +891,10 @@ body .profiler-graph .recharts-active-dot circle {
|
|||||||
height: auto !important;
|
height: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.CodeMirror-wrap pre.CodeMirror-line {
|
||||||
|
padding-right: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
.entity-feed-list {
|
.entity-feed-list {
|
||||||
grid-template-columns: 200px auto 200px;
|
grid-template-columns: 200px auto 200px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user