diff --git a/packages/extension/src/view/design-system/components/circlePieChart/emptyCirclePieChart.tsx b/packages/extension/src/view/design-system/components/circlePieChart/emptyCirclePieChart.tsx index 74ed4e068..363f1e2fb 100644 --- a/packages/extension/src/view/design-system/components/circlePieChart/emptyCirclePieChart.tsx +++ b/packages/extension/src/view/design-system/components/circlePieChart/emptyCirclePieChart.tsx @@ -24,11 +24,7 @@ import { VictoryPie } from 'victory'; */ import { COLOR_MAP } from '../../theme/colors'; -interface EmptyCirclePieChartProps { - fallbackText?: string; -} - -const EmptyCirclePieChart = ({ fallbackText }: EmptyCirclePieChartProps) => { +const EmptyCirclePieChart = () => { return (
{ colorScale={[COLOR_MAP.brightGray]} data={[{ x: '', y: 100 }]} /> -

- {fallbackText || 'Not Found'} +

+ 0

); diff --git a/packages/extension/src/view/design-system/components/circlePieChart/index.tsx b/packages/extension/src/view/design-system/components/circlePieChart/index.tsx index 071d7ad87..5fac5194d 100644 --- a/packages/extension/src/view/design-system/components/circlePieChart/index.tsx +++ b/packages/extension/src/view/design-system/components/circlePieChart/index.tsx @@ -40,7 +40,6 @@ const CirclePieChart = ({ centerCount, data, title, - fallbackText, infoIconClassName = '', }: CirclePieChartProps) => { const centerTitleClasses = centerCount <= MAX_COUNT ? 'text-2xl' : 'text-l'; @@ -49,7 +48,7 @@ const CirclePieChart = ({ <>
{centerCount <= 0 ? ( - + ) : (
{ { count: 73, color: 'blue' }, ]; - it('renders EmptyCirclePieChart when centerCount is 0', () => { - const centerCount = 0; - const title = 'Empty Chart'; - const fallbackText = 'No Data'; - - const { getByText } = render( - - ); - - // Check if the EmptyCirclePieChart is rendered when centerCount is 0 - const emptyChartTitle = getByText(title); - expect(emptyChartTitle).toBeInTheDocument(); - const fallbackTextElement = getByText(fallbackText); - expect(fallbackTextElement).toBeInTheDocument(); - }); - it('renders CirclePieChart with correct centerCount when centerCount is less than or equal to MAX_COUNT', () => { const centerCount = 123; const title = '1st Party cookies'; diff --git a/packages/extension/src/view/design-system/components/circlePieChart/tests/emptyCirclePieChart.tsx b/packages/extension/src/view/design-system/components/circlePieChart/tests/emptyCirclePieChart.tsx deleted file mode 100644 index 9760fb263..000000000 --- a/packages/extension/src/view/design-system/components/circlePieChart/tests/emptyCirclePieChart.tsx +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2023 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * External dependencies. - */ -import React from 'react'; -import { render } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; - -/** - * Internal Dependencies - */ -import EmptyCirclePieChart from '../emptyCirclePieChart'; - -describe('EmptyCirclePieChart', () => { - it('renders the fallback text correctly when provided', () => { - const fallbackText = 'No data'; - - const { getByText } = render( - - ); - - // Check if the fallback text is rendered correctly when provided - const fallbackTextElement = getByText(fallbackText); - expect(fallbackTextElement).toBeInTheDocument(); - }); - - it('renders the default fallback text correctly when not provided', () => { - const defaultFallbackText = 'Not Found'; - - const { getByText } = render(); - - // Check if the default fallback text is rendered correctly when not provided - const defaultFallbackTextElement = getByText(defaultFallbackText); - expect(defaultFallbackTextElement).toBeInTheDocument(); - }); -});