diff --git a/plugins/airbrake/src/api/production-api.test.ts b/plugins/airbrake/src/api/production-api.test.ts
index 89b7908f9a..3753cab592 100644
--- a/plugins/airbrake/src/api/production-api.test.ts
+++ b/plugins/airbrake/src/api/production-api.test.ts
@@ -40,7 +40,7 @@ describe('The production Airbrake API', () => {
it('throws if fetching groups was unsuccessful', async () => {
const scope = nock('https://api.airbrake.io')
.get('/api/v4/projects/123456/groups?key=fakeApiKey')
- .reply(500, mockGroupsData);
+ .reply(500);
expect(scope.isDone()).toBe(false);
await expect(productionApi.fetchGroups('123456')).rejects.toThrow();
diff --git a/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx b/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
index 5baabe92f6..5d3787b875 100644
--- a/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
+++ b/plugins/airbrake/src/components/EntityAirbrakeWidget/EntityAirbrakeWidget.test.tsx
@@ -19,7 +19,12 @@ import { EntityAirbrakeWidget } from './EntityAirbrakeWidget';
import exampleData from '../../api/mock/airbrake-groups-api-mock.json';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import { createEntity } from '../../api/mock/mock-entity';
-import { airbrakeApiRef, MockAirbrakeApi } from '../../api';
+import {
+ airbrakeApiRef,
+ MockAirbrakeApi,
+ ProductionAirbrakeApi,
+} from '../../api';
+import nock from 'nock';
describe('EntityAirbrakeContent', () => {
it('renders all errors sent from Airbrake', async () => {
@@ -36,15 +41,34 @@ describe('EntityAirbrakeContent', () => {
}
});
- it('states that the annotation is missing if no annotation is provided', async () => {
+ it('states that the annotation is missing if no project ID annotation is provided', async () => {
const table = await renderInTestApp(
,
);
- expect(exampleData.groups.length).toBeGreaterThan(0);
await expect(
table.findByText('Missing Annotation'),
).resolves.toBeInTheDocument();
});
+
+ it('states that an error occurred if API call fails', async () => {
+ const scope = nock('https://api.airbrake.io')
+ .get('/api/v4/projects/123/groups?key=fakeApiKey')
+ .reply(500);
+ expect(scope.isDone()).toBe(false);
+
+ const table = await renderInTestApp(
+
+
+ ,
+ );
+
+ await expect(
+ table.findByText('*there was an issue communicating with Airbrake*'),
+ ).resolves.toBeInTheDocument();
+ expect(scope.isDone()).toBe(true);
+ });
});