Skip to content

Commit

Permalink
fix(KONFLUX-1680): filter records on creationTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavJochman committed Feb 6, 2025
1 parent 0011b31 commit 3fde56e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 30 deletions.
18 changes: 1 addition & 17 deletions src/components/Activity/__tests__/ActivityTab.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { useNavigate, useParams } from 'react-router-dom';
import { act, fireEvent, screen } from '@testing-library/react';
import {
createK8sWatchResourceMock,
routerRenderer,
createUseApplicationMock,
} from '../../../utils/test-utils';
import { createK8sWatchResourceMock, routerRenderer } from '../../../utils/test-utils';
import { ACTIVITY_SECONDARY_TAB_KEY, ActivityTab } from '../ActivityTab';

jest.mock('react-router-dom', () => {
Expand All @@ -16,18 +12,6 @@ jest.mock('react-router-dom', () => {
};
});

const mockUseApplication = createUseApplicationMock([{ metadata: { name: 'test' } }, true]);

describe('useApplication hook', () => {
beforeEach(() => {
mockUseApplication.mockReturnValue([{ metadata: { name: 'test' } }, true]);
});
it('should return application', () => {
const result = mockUseApplication();
expect(result).toEqual([{ metadata: { name: 'test' } }, true]);
});
});

jest.mock('../../Workspace/useWorkspaceInfo', () => ({
useWorkspaceInfo: jest.fn(() => ({ namespace: 'test-ns', workspace: 'test-ws' })),
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useComponents } from '../../../../hooks/useComponents';
import { useTRPipelineRuns } from '../../../../hooks/useTektonResults';
import * as dateTime from '../../../../shared/components/timestamp/datetime';
import { getCommitsFromPLRs } from '../../../../utils/commits-utils';
import { createK8sWatchResourceMock } from '../../../../utils/test-utils';
import { createK8sWatchResourceMock, createUseApplicationMock } from '../../../../utils/test-utils';
import { pipelineWithCommits } from '../../__data__/pipeline-with-commits';
import { MockComponents } from '../../CommitDetails/visualization/__data__/MockCommitWorkflowData';
import CommitsListRow from '../CommitsListRow';
Expand All @@ -30,9 +30,7 @@ jest.mock('../../commit-status', () => ({
useCommitStatus: () => ['-', true],
}));

jest.mock('../../../../hooks/useApplications', () => ({
useApplication: jest.fn().mockReturnValue([{ metadata: { name: 'test' } }, true]),
}));
createUseApplicationMock([{ metadata: { name: 'test' } }, true]);

jest.mock('../../../../shared/components/table/TableComponent', () => {
return (props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { screen, fireEvent, act } from '@testing-library/react';
import { useComponent, useComponents } from '../../../../hooks/useComponents';
import {
createK8sWatchResourceMock,
createUseApplicationMock,
createUseWorkspaceInfoMock,
routerRenderer,
} from '../../../../utils/test-utils';
Expand All @@ -27,9 +28,7 @@ jest.mock('../../../../hooks/useComponents', () => ({
useComponent: jest.fn(),
}));

jest.mock('../../../../hooks/useApplications', () => ({
useApplication: jest.fn().mockReturnValue([{ metadata: { name: 'test' } }, true]),
}));
createUseApplicationMock([{ metadata: { name: 'test' } }, true]);

const watchResourceMock = createK8sWatchResourceMock();
const useComponentsMock = useComponents as jest.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ jest.mock('../../../../utils/rbac', () => ({
useAccessReviewForModel: jest.fn(() => [true, true]),
}));

jest.mock('../../../../hooks/useApplications', () => ({
useApplication: jest.fn().mockReturnValue([{ metadata: { name: 'test' } }, true]),
}));
createUseApplicationMock([{ metadata: { name: 'test' } }, true]);

jest.mock('react-router-dom', () => {
const actual = jest.requireActual('react-router-dom');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ jest.mock('../../../../hooks/usePipelineRuns', () => ({
usePipelineRuns: jest.fn(),
}));

jest.mock('../../../../hooks/useApplications', () => ({
useApplication: jest.fn().mockReturnValue([{ metadata: { name: 'test' } }, true]),
}));
createUseApplicationMock([{ metadata: { name: 'test' } }, true]);

jest.mock('../../../../hooks/useScanResults', () => ({
usePLRVulnerabilities: jest.fn(() => ({ vulnerabilities: {}, fetchedPipelineRuns: [] })),
Expand Down

0 comments on commit 3fde56e

Please sign in to comment.