mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 07:23:39 +00:00
This commit is contained in:
parent
9135b8faaf
commit
189e0b82d0
@ -27,6 +27,7 @@ import { ResourceEntity } from '../../../../context/PermissionProvider/Permissio
|
|||||||
import { Operation } from '../../../../generated/entity/policies/policy';
|
import { Operation } from '../../../../generated/entity/policies/policy';
|
||||||
import { checkPermission } from '../../../../utils/PermissionsUtils';
|
import { checkPermission } from '../../../../utils/PermissionsUtils';
|
||||||
import AppBadge from '../../../common/Badge/Badge.component';
|
import AppBadge from '../../../common/Badge/Badge.component';
|
||||||
|
import '../incident-manager.style.less';
|
||||||
import { SeverityProps } from './Severity.interface';
|
import { SeverityProps } from './Severity.interface';
|
||||||
import SeverityModal from './SeverityModal.component';
|
import SeverityModal from './SeverityModal.component';
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import {
|
|||||||
omitBy,
|
omitBy,
|
||||||
pick,
|
pick,
|
||||||
round,
|
round,
|
||||||
uniqueId,
|
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
import { DateRangeObject } from 'Models';
|
import { DateRangeObject } from 'Models';
|
||||||
import React, {
|
import React, {
|
||||||
@ -343,7 +342,7 @@ const TestSummary: React.FC<TestSummaryProps> = ({ data }) => {
|
|||||||
<Line
|
<Line
|
||||||
dataKey={info.label}
|
dataKey={info.label}
|
||||||
dot={updatedDot}
|
dot={updatedDot}
|
||||||
key={uniqueId(info.label)}
|
key={info.label}
|
||||||
stroke={info.color}
|
stroke={info.color}
|
||||||
type="monotone"
|
type="monotone"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -10,8 +10,9 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { render, screen } from '@testing-library/react';
|
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { getListTestCaseIncidentStatus } from '../../rest/incidentManagerAPI';
|
||||||
import IncidentManagerPage from './IncidentManagerPage';
|
import IncidentManagerPage from './IncidentManagerPage';
|
||||||
|
|
||||||
jest.mock('../../components/common/NextPrevious/NextPrevious', () => {
|
jest.mock('../../components/common/NextPrevious/NextPrevious', () => {
|
||||||
@ -20,9 +21,21 @@ jest.mock('../../components/common/NextPrevious/NextPrevious', () => {
|
|||||||
jest.mock(
|
jest.mock(
|
||||||
'../../components/common/DatePickerMenu/DatePickerMenu.component',
|
'../../components/common/DatePickerMenu/DatePickerMenu.component',
|
||||||
() => {
|
() => {
|
||||||
return jest
|
return jest.fn().mockImplementation(({ handleDateRangeChange }) => (
|
||||||
.fn()
|
<div>
|
||||||
.mockImplementation(() => <div>DatePickerMenu.component</div>);
|
<p>DatePickerMenu.component</p>
|
||||||
|
<button
|
||||||
|
data-testid="time-filter"
|
||||||
|
onClick={() =>
|
||||||
|
handleDateRangeChange({
|
||||||
|
startTs: 1709556624254,
|
||||||
|
endTs: 1710161424255,
|
||||||
|
})
|
||||||
|
}>
|
||||||
|
time filter
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
jest.mock('../../components/PageLayoutV1/PageLayoutV1', () => {
|
jest.mock('../../components/PageLayoutV1/PageLayoutV1', () => {
|
||||||
@ -98,4 +111,23 @@ describe('IncidentManagerPage', () => {
|
|||||||
await screen.findByText('NextPrevious.component')
|
await screen.findByText('NextPrevious.component')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Incident should be fetch with updated time', async () => {
|
||||||
|
const mockGetListTestCaseIncidentStatus =
|
||||||
|
getListTestCaseIncidentStatus as jest.Mock;
|
||||||
|
render(<IncidentManagerPage />);
|
||||||
|
|
||||||
|
const timeFilterButton = await screen.findByTestId('time-filter');
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
fireEvent.click(timeFilterButton);
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(mockGetListTestCaseIncidentStatus).toHaveBeenCalledWith({
|
||||||
|
endTs: 1710161424255,
|
||||||
|
latest: true,
|
||||||
|
limit: 10,
|
||||||
|
startTs: 1709556624254,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { DefaultOptionType } from 'antd/lib/select';
|
|||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { compare } from 'fast-json-patch';
|
import { compare } from 'fast-json-patch';
|
||||||
import { isEqual, startCase } from 'lodash';
|
import { isEqual, pick, startCase } from 'lodash';
|
||||||
import { DateRangeObject } from 'Models';
|
import { DateRangeObject } from 'Models';
|
||||||
import QueryString from 'qs';
|
import QueryString from 'qs';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
@ -242,13 +242,11 @@ const IncidentManagerPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDateRangeChange = (value: DateRangeObject) => {
|
const handleDateRangeChange = (value: DateRangeObject) => {
|
||||||
const dateRangeObject = {
|
const updatedFilter = pick(value, ['startTs', 'endTs']);
|
||||||
startTs: filters.startTs,
|
const existingFilters = pick(filters, ['startTs', 'endTs']);
|
||||||
endTs: filters.endTs,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!isEqual(value, dateRangeObject)) {
|
if (!isEqual(existingFilters, updatedFilter)) {
|
||||||
setFilters((pre) => ({ ...pre, ...dateRangeObject }));
|
setFilters((pre) => ({ ...pre, ...updatedFilter }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user