From 56926b6f1e365209f5079086820754222b88c82b Mon Sep 17 00:00:00 2001 From: Alec Jacobs Date: Mon, 30 May 2022 07:28:51 -0700 Subject: [PATCH] chore(plugins/pagerduty): move mockPagerDutyApi to not reference const before it is defined Signed-off-by: Alec Jacobs --- .../components/PagerDutyCard/index.test.tsx | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/plugins/pagerduty/src/components/PagerDutyCard/index.test.tsx b/plugins/pagerduty/src/components/PagerDutyCard/index.test.tsx index 041f76fb8c..fbb19c9897 100644 --- a/plugins/pagerduty/src/components/PagerDutyCard/index.test.tsx +++ b/plugins/pagerduty/src/components/PagerDutyCard/index.test.tsx @@ -20,28 +20,12 @@ import { Entity } from '@backstage/catalog-model'; import { EntityProvider } from '@backstage/plugin-catalog-react'; import { NotFoundError } from '@backstage/errors'; import { TestApiRegistry, wrapInTestApp } from '@backstage/test-utils'; -import { - pagerDutyApiRef, - UnauthorizedError, - PagerDutyClient, -} from '../../api'; +import { pagerDutyApiRef, UnauthorizedError, PagerDutyClient } from '../../api'; import { Service, User } from '../types'; import { alertApiRef } from '@backstage/core-plugin-api'; import { ApiProvider } from '@backstage/core-app-api'; -const mockPagerDutyApi: Partial = { - getServiceByIntegrationKey: async () => [], - getServiceByServiceId: async () => service, - getOnCallByPolicyId: async () => [], - getIncidentsByServiceId: async () => [], -}; - -const apis = TestApiRegistry.from( - [pagerDutyApiRef, mockPagerDutyApi], - [alertApiRef, {}], -); - const entity: Entity = { apiVersion: 'backstage.io/v1alpha1', kind: 'Component', @@ -105,6 +89,18 @@ const service: Service = { integrationKey: 'abc123', }; +const mockPagerDutyApi: Partial = { + getServiceByIntegrationKey: async () => [], + getServiceByServiceId: async () => service, + getOnCallByPolicyId: async () => [], + getIncidentsByServiceId: async () => [], +}; + +const apis = TestApiRegistry.from( + [pagerDutyApiRef, mockPagerDutyApi], + [alertApiRef, {}], +); + describe('isPluginApplicableToEntity', () => { describe('when entity has no annotations', () => { it('returns false', () => {