chore(plugins/pagerduty): move mockPagerDutyApi to not reference const before it is defined

Signed-off-by: Alec Jacobs <cajacobs5401@gmail.com>
This commit is contained in:
Alec Jacobs
2022-05-30 07:28:51 -07:00
parent d8abae2ce6
commit 56926b6f1e
@@ -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<PagerDutyClient> = {
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<PagerDutyClient> = {
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', () => {