silence some noisy tests
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-pagerduty': patch
|
||||
---
|
||||
|
||||
Minor internal tweaks to improve tests
|
||||
@@ -113,6 +113,8 @@ describe('buildApiReports', () => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
jest.spyOn(console, 'log').mockImplementation(() => {});
|
||||
|
||||
it('should run without any options', async () => {
|
||||
const opts = {};
|
||||
const paths: string[] = [];
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { screen, waitFor, fireEvent, act } from '@testing-library/react';
|
||||
import { PagerDutyCard } from '../PagerDutyCard';
|
||||
import { PagerDutyCard } from './PagerDutyCard';
|
||||
import { NotFoundError } from '@backstage/errors';
|
||||
import { TestApiRegistry, renderInTestApp } from '@backstage/test-utils';
|
||||
import { pagerDutyApiRef, UnauthorizedError, PagerDutyClient } from '../../api';
|
||||
+26
-19
@@ -13,8 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { ReactNode, useState, useCallback } from 'react';
|
||||
import { Card, CardHeader, Divider, CardContent } from '@material-ui/core';
|
||||
import {
|
||||
Card,
|
||||
CardHeader,
|
||||
Divider,
|
||||
CardContent,
|
||||
TabProps,
|
||||
} from '@material-ui/core';
|
||||
import { Incidents } from '../Incident';
|
||||
import { EscalationPolicy } from '../Escalation';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
@@ -146,6 +153,23 @@ export const PagerDutyCard = (props: PagerDutyCardProps) => {
|
||||
icon: <DateRangeIcon />,
|
||||
};
|
||||
|
||||
const tabs: React.ReactElement<TabProps>[] = [
|
||||
<CardTab label="Incidents" key="incidents">
|
||||
<Incidents serviceId={service!.id} refreshIncidents={refreshIncidents} />
|
||||
</CardTab>,
|
||||
];
|
||||
|
||||
if (disableChangeEvents !== true) {
|
||||
tabs.push(
|
||||
<CardTab label="Change Events" key="change events">
|
||||
<ChangeEvents
|
||||
serviceId={service!.id}
|
||||
refreshEvents={refreshChangeEvents}
|
||||
/>
|
||||
</CardTab>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card data-testid="pagerduty-card">
|
||||
@@ -163,24 +187,7 @@ export const PagerDutyCard = (props: PagerDutyCardProps) => {
|
||||
/>
|
||||
<Divider />
|
||||
<CardContent>
|
||||
<TabbedCard>
|
||||
<CardTab label="Incidents">
|
||||
<Incidents
|
||||
serviceId={service!.id}
|
||||
refreshIncidents={refreshIncidents}
|
||||
/>
|
||||
</CardTab>
|
||||
<>
|
||||
{disableChangeEvents !== true && (
|
||||
<CardTab label="Change Events">
|
||||
<ChangeEvents
|
||||
serviceId={service!.id}
|
||||
refreshEvents={refreshChangeEvents}
|
||||
/>
|
||||
</CardTab>
|
||||
)}
|
||||
</>
|
||||
</TabbedCard>
|
||||
<TabbedCard>{...tabs}</TabbedCard>
|
||||
<EscalationPolicy policyId={service!.policyId} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2023 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.
|
||||
*/
|
||||
|
||||
export { PagerDutyCard, type PagerDutyCardProps } from './PagerDutyCard';
|
||||
@@ -131,7 +131,7 @@ export const TriggerDialog = ({
|
||||
id="description"
|
||||
multiline
|
||||
fullWidth
|
||||
rows="4"
|
||||
minRows={4}
|
||||
margin="normal"
|
||||
label="Problem description"
|
||||
variant="outlined"
|
||||
|
||||
Reference in New Issue
Block a user