Merge pull request #14654 from acierto/cost-insight-trending-line

Making a possibility to hide a trending line in a cost insights plugin
This commit is contained in:
Johan Haals
2022-11-23 13:46:04 +01:00
committed by GitHub
15 changed files with 149 additions and 46 deletions
+6
View File
@@ -25,6 +25,7 @@ import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import { Observable } from '@backstage/types';
import { PermissionApi } from '@backstage/plugin-permission-react';
import { PropsWithChildren } from 'react';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { RenderOptions } from '@testing-library/react';
@@ -165,6 +166,11 @@ export class MockPermissionApi implements PermissionApi {
): Promise<EvaluatePermissionResponse>;
}
// @alpha
export const MockPluginProvider: ({
children,
}: PropsWithChildren<{}>) => JSX.Element;
// @public
export class MockStorageApi implements StorageApi {
// (undocumented)
+5 -3
View File
@@ -5,7 +5,8 @@
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
"types": "dist/index.d.ts",
"alphaTypes": "dist/index.alpha.d.ts"
},
"backstage": {
"role": "web-library"
@@ -23,7 +24,7 @@
"main": "src/index.ts",
"types": "src/index.ts",
"scripts": {
"build": "backstage-cli package build",
"build": "backstage-cli package build --experimental-type-build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"prepack": "backstage-cli package prepack",
@@ -60,6 +61,7 @@
"msw": "^0.49.0"
},
"files": [
"dist"
"dist",
"alpha"
]
}
@@ -24,6 +24,7 @@ export {
export type { TestAppOptions } from './appWrappers';
export * from './msw';
export * from './logCollector';
export * from './providers';
export * from './testingLibrary';
export { TestApiProvider, TestApiRegistry } from './TestApiProvider';
export type { TestApiProviderProps } from './TestApiProvider';
@@ -0,0 +1,35 @@
/*
* Copyright 2020 The Backstage Authors
*
* 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
*
* http://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.
*/
import React, { PropsWithChildren } from 'react';
import { createPlugin, PluginProvider } from '@backstage/core-plugin-api';
/**
* Mock for PluginProvider to use in unit tests
* @alpha
*/
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>;
};