diff --git a/plugins/airbrake/dev/index.tsx b/plugins/airbrake/dev/index.tsx
index ec6c4fd0b6..cd980408ae 100644
--- a/plugins/airbrake/dev/index.tsx
+++ b/plugins/airbrake/dev/index.tsx
@@ -15,7 +15,7 @@
*/
import React from 'react';
import { createDevApp } from '@backstage/dev-utils';
-import { EntityAirbrakeContent, airbrakePlugin } from '../src';
+import { airbrakePlugin, EntityAirbrakeContent } from '../src';
import {
Content,
ContentHeader,
@@ -25,6 +25,8 @@ import {
SupportButton,
} from '@backstage/core-components';
import { airbrakeApiRef, MockAirbrakeApi } from '../src/api';
+import { EntityProvider } from '@backstage/plugin-catalog-react';
+import { entity } from '../src/api/mock/mock-entity';
createDevApp()
.registerPlugin(airbrakePlugin)
@@ -49,7 +51,9 @@ createDevApp()
A description of your plugin goes here.
-
+
+
+
),
diff --git a/plugins/airbrake/src/api/mock/mock-entity.ts b/plugins/airbrake/src/api/mock/mock-entity.ts
new file mode 100644
index 0000000000..7e5b897cca
--- /dev/null
+++ b/plugins/airbrake/src/api/mock/mock-entity.ts
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2022 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 { AIRBRAKE_PROJECT_SLUG_ANNOTATION } from '../../components/useProjectSlug';
+import { Entity } from '@backstage/catalog-model';
+
+export const entity = (name?: string) =>
+ ({
+ apiVersion: 'backstage.io/v1alpha1',
+ kind: 'Component',
+ metadata: {
+ annotations: {
+ [AIRBRAKE_PROJECT_SLUG_ANNOTATION]: name,
+ },
+ name: name,
+ },
+ } as Entity);
diff --git a/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx b/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
index d93c642e6c..000bd8f230 100644
--- a/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
+++ b/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
@@ -18,22 +18,9 @@ import React from 'react';
import { EntityAirbrakeWidget } from './EntityAirbrakeWidget';
import exampleData from '../../api/mock/airbrake-groups-api-mock.json';
import { renderInTestApp } from '@backstage/test-utils';
-import { AIRBRAKE_PROJECT_SLUG_ANNOTATION } from '../useProjectSlug';
-import { Entity } from '@backstage/catalog-model';
+import { entity } from '../../api/mock/mock-entity';
describe('EntityAirbrakeContent', () => {
- const entity = (name?: string) =>
- ({
- apiVersion: 'backstage.io/v1alpha1',
- kind: 'Component',
- metadata: {
- annotations: {
- [AIRBRAKE_PROJECT_SLUG_ANNOTATION]: name,
- },
- name: name,
- },
- } as Entity);
-
it('renders all errors sent from Airbrake', async () => {
const table = await renderInTestApp(
,
diff --git a/plugins/airbrake/src/extensions.tsx b/plugins/airbrake/src/extensions.tsx
index 582088b250..6fbea68409 100644
--- a/plugins/airbrake/src/extensions.tsx
+++ b/plugins/airbrake/src/extensions.tsx
@@ -27,11 +27,10 @@ export const EntityAirbrakeContent = airbrakePlugin.provide(
component: () =>
import('./components/EntityAirbrakeWidget').then(
({ EntityAirbrakeWidget }) => {
- const AirbrakePage = () => {
+ return () => {
const { entity } = useEntity();
return ;
};
- return AirbrakePage;
},
),
}),