Incorporated the feedback

Signed-off-by: bogdannechyporenko <bogdannechiporenko@gmail.com>
This commit is contained in:
bogdannechyporenko
2022-11-17 16:58:58 +01:00
parent 0708ac37de
commit 03360e1d40
7 changed files with 56 additions and 47 deletions
+1
View File
@@ -38,6 +38,7 @@
"@backstage/core-plugin-api": "workspace:^",
"@backstage/plugin-catalog-react": "workspace:^",
"@backstage/plugin-cost-insights-common": "workspace:^",
"@backstage/test-utils": "workspace:^",
"@backstage/theme": "workspace:^",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
@@ -15,7 +15,7 @@
*/
import React from 'react';
import { fireEvent } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { MockPluginProvider, renderInTestApp } from '@backstage/test-utils';
import { CostOverviewCard } from './CostOverviewCard';
import { Cost } from '../../types';
import {
@@ -23,12 +23,11 @@ import {
getGroupedProducts,
getGroupedProjects,
MockAggregatedDailyCosts,
trendlineOf,
MockBillingDateProvider,
MockConfigProvider,
MockFilterProvider,
MockScrollProvider,
MockPluginProvider,
trendlineOf,
} from '../../testUtils';
import { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider';
@@ -14,20 +14,22 @@
* limitations under the License.
*/
import React from 'react';
import { renderInTestApp } from '@backstage/test-utils';
import {
MockPluginProvider,
renderInTestApp,
TestApiProvider,
} from '@backstage/test-utils';
import {
changeOf,
MockAggregatedDailyCosts,
MockBillingDateProvider,
MockConfigProvider,
MockFilterProvider,
MockPluginProvider,
MockScrollProvider,
trendlineOf,
} from '../../testUtils';
import { CostInsightsThemeProvider } from '../CostInsightsPage/CostInsightsThemeProvider';
import { EntityCostsCard } from './EntityCosts';
import { TestApiProvider } from '@backstage/test-utils';
import { CostInsightsApi, costInsightsApiRef } from '../../api';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { Entity } from '@backstage/catalog-model';
@@ -15,18 +15,23 @@
*/
import React, { PropsWithChildren } from 'react';
import { LoadingContext, LoadingContextProps } from '../hooks/useLoading';
import { GroupsContext, GroupsContextProps } from '../hooks/useGroups';
import { FilterContext, FilterContextProps } from '../hooks/useFilters';
import { ConfigContext, ConfigContextProps } from '../hooks/useConfig';
import { CurrencyContext, CurrencyContextProps } from '../hooks/useCurrency';
import {
LoadingContext,
LoadingContextProps,
GroupsContext,
GroupsContextProps,
FilterContext,
FilterContextProps,
ConfigContext,
ConfigContextProps,
CurrencyContext,
CurrencyContextProps,
BillingDateContext,
BillingDateContextProps,
} from '../hooks/useLastCompleteBillingDate';
import { ScrollContext, ScrollContextProps } from '../hooks/useScroll';
ScrollContext,
ScrollContextProps,
} from '../hooks';
import { Group, Duration } from '../types';
import { createPlugin, PluginProvider } from '@backstage/core-plugin-api';
export const MockGroups: Group[] = [{ id: 'tech' }, { id: 'mock-group' }];
@@ -145,19 +150,6 @@ export const MockBillingDateProvider = ({
export type MockScrollProviderProps = PropsWithChildren<{}>;
export const MockPluginProvider = ({ children }: PropsWithChildren<{}>) => {
type TestInputPluginOptions = {};
type TestPluginOptions = {};
const plugin = createPlugin({
id: 'my-plugin',
__experimentalConfigure(_: TestInputPluginOptions): TestPluginOptions {
return {};
},
});
return <PluginProvider plugin={plugin}>{children}</PluginProvider>;
};
export const MockScrollProvider = ({ children }: MockScrollProviderProps) => {
const defaultContext: ScrollContextProps = {
scroll: null,