1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-07 23:05:26 +02:00

chore(tests): clean tests output [EE-5758] (#9215)

This commit is contained in:
Chaim Lev-Ari 2023-08-27 13:30:45 +03:00 committed by GitHub
parent 2953848b9a
commit 531f88b947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 25 additions and 11 deletions

View file

@ -1,2 +0,0 @@
export default 'SvgrURL';
export const ReactComponent = 'div';

8
app/__mocks__/svg.tsx Normal file
View file

@ -0,0 +1,8 @@
import { forwardRef } from 'react';
const SvgrMock = forwardRef<HTMLSpanElement>((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
<span ref={ref} {...props} />
));
export default SvgrMock;

View file

@ -71,6 +71,8 @@ test('should correctly show total number of resource groups across multiple subs
});
test("when only subscriptions fail to load, don't show the dashboard", async () => {
jest.spyOn(console, 'error').mockImplementation(() => {});
const { queryByLabelText } = await renderComponent(
1,
{ 'subscription-1': 1 },
@ -82,6 +84,8 @@ test("when only subscriptions fail to load, don't show the dashboard", async ()
});
test('when only resource groups fail to load, still show the subscriptions', async () => {
jest.spyOn(console, 'error').mockImplementation(() => {});
const { queryByLabelText, findByLabelText } = await renderComponent(
1,
{ 'subscription-1': 1 },

View file

@ -2,6 +2,8 @@ import { Activity } from 'lucide-react';
import { isoDateFromTimestamp } from '@/portainer/filters/filters';
import { Environment } from '@/react/portainer/environments/types';
import heartbeatup from '@/assets/ico/heartbeat-up.svg?c';
import heartbeatdown from '@/assets/ico/heartbeat-down.svg?c';
import { EnvironmentStatusBadgeItem } from './EnvironmentStatusBadgeItem';
@ -35,7 +37,7 @@ export function EdgeIndicator({
>
<EnvironmentStatusBadgeItem
color={heartbeat ? 'success' : 'danger'}
icon={heartbeat ? 'svg-heartbeatup' : 'svg-heartbeatdown'}
icon={heartbeat ? heartbeatup : heartbeatdown}
aria-label="edge-heartbeat"
>
heartbeat

View file

@ -1,6 +1,5 @@
// general icons
import heartbeatup from '@/assets/ico/heartbeat-up.svg?c';
import heartbeatdown from '@/assets/ico/heartbeat-down.svg?c';
import dataflow from '@/assets/ico/dataflow-1.svg?c';
import git from '@/assets/ico/git.svg?c';
import kube from '@/assets/ico/kube.svg?c';
@ -40,8 +39,6 @@ import quay from '@/assets/ico/vendor/quay.svg?c';
const placeholder = Placeholder;
export const SvgIcons = {
heartbeatup,
heartbeatdown,
dataflow,
dockericon,
git,

View file

@ -132,6 +132,7 @@ export function ConsoleView() {
value={command}
onChange={(e) => setCommand(e.target.value)}
id="consoleCommand"
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus
/>
</div>

View file

@ -91,4 +91,8 @@ export const handlers = [
'/api/status',
(req, res, ctx) => res(ctx.json({}))
),
rest.get('/api/teams/:id/memberships', (req, res, ctx) => res(ctx.json([]))),
rest.get('/api/endpoints/agent_versions', (req, res, ctx) =>
res(ctx.json([]))
),
];