Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-madlani committed Jul 25, 2024
1 parent f0fd9f6 commit f5b90bf
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jest.mock('react-router-dom', () => ({
}));

jest.mock('../../rest/DataInsightAPI', () => ({
...jest.requireActual('../../rest/DataInsightAPI'),
getAggregateChartData: jest.fn().mockImplementation(() => Promise.resolve()),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import './data-insight-detail.less';

interface Props {
chartFilter: ChartFilter;
onScrollToChart: (chartType: DataInsightChartType) => void;
onScrollToChart: (chartType: SystemChartType | DataInsightChartType) => void;
}

const DataInsightSummary: FC<Props> = ({ chartFilter, onScrollToChart }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ export const INITIAL_CHART_FILTER: ChartFilter = {
};

export const ENTITIES_CHARTS = [
DataInsightChartType.TotalEntitiesByType,
DataInsightChartType.PercentageOfEntitiesWithDescriptionByType,
DataInsightChartType.PercentageOfEntitiesWithOwnerByType,
DataInsightChartType.TotalEntitiesByTier,
SystemChartType.TotalDataAssets,
SystemChartType.PercentageOfDataAssetWithDescription,
SystemChartType.PercentageOfDataAssetWithOwner,
SystemChartType.TotalDataAssetsByTier,
];

export const WEB_CHARTS = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* limitations under the License.
*/
import { DataInsightChartType } from '../../../generated/dataInsight/dataInsightChartResult';
import { SystemChartType } from '../../../rest/DataInsightAPI';

export interface DataInsightHeaderProps {
onScrollToChart: (chartType: DataInsightChartType) => void;
onScrollToChart: (chartType: SystemChartType | DataInsightChartType) => void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
import { DataInsightChartType } from '../../generated/dataInsight/dataInsightChartResult';
import { Operation } from '../../generated/entity/policies/policy';
import { DataInsightTabs } from '../../interface/data-insight.interface';
import { SystemChartType } from '../../rest/DataInsightAPI';
import { getDataInsightPathWithFqn } from '../../utils/DataInsightUtils';
import { checkPermission } from '../../utils/PermissionsUtils';
import './data-insight.less';
Expand Down Expand Up @@ -73,10 +74,14 @@ const DataInsightPage = () => {
[permissions]
);

const [selectedChart, setSelectedChart] = useState<DataInsightChartType>();
const [selectedChart, setSelectedChart] = useState<
SystemChartType | DataInsightChartType
>();

const handleScrollToChart = (chartType: DataInsightChartType) => {
if (ENTITIES_CHARTS.includes(chartType)) {
const handleScrollToChart = (
chartType: SystemChartType | DataInsightChartType
) => {
if (ENTITIES_CHARTS.includes(chartType as SystemChartType)) {
history.push(getDataInsightPathWithFqn(DataInsightTabs.DATA_ASSETS));
} else {
history.push(getDataInsightPathWithFqn(DataInsightTabs.APP_ANALYTICS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ const DataInsightProvider = ({ children }: DataInsightProviderProps) => {
data: kpiList,
},
teamFilter: {
options: uniqBy(teamsOptions.options, 'id'),
options: uniqBy(teamsOptions.options, 'key'),
selectedKeys: teamsOptions.selectedOptions,
onChange: handleTeamChange,
onGetInitialOptions: fetchDefaultTeamOptions,
Expand Down

0 comments on commit f5b90bf

Please sign in to comment.