Merge pull request #24786 from backstage/freben/untruncate

remove last remnants of react-text-truncate from test mocks
This commit is contained in:
Fredrik Adelöw
2024-05-16 09:47:06 +02:00
committed by GitHub
3 changed files with 0 additions and 31 deletions
@@ -36,19 +36,6 @@ import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { Observable } from '@backstage/types';
// Mock needed because jsdom doesn't correctly implement box-sizing
// https://github.com/ShinyChang/React-Text-Truncate/issues/70
// https://stackoverflow.com/questions/71916701/how-to-mock-a-react-function-component-that-takes-a-ref-prop
jest.mock('react-text-truncate', () => {
const { forwardRef } = jest.requireActual('react');
return {
__esModule: true,
default: forwardRef((props: any, ref: any) => (
<div ref={ref}>{props.text}</div>
)),
};
});
const mockedStarredEntitiesApi: Partial<StarredEntitiesApi> = {
starredEntitie$: () => {
return {
@@ -120,19 +120,6 @@ const getEntitiesMock = (
} as GetEntitiesResponse);
};
// Mock needed because jsdom doesn't correctly implement box-sizing
// https://github.com/ShinyChang/React-Text-Truncate/issues/70
// https://stackoverflow.com/questions/71916701/how-to-mock-a-react-function-component-that-takes-a-ref-prop
jest.mock('react-text-truncate', () => {
const { forwardRef } = jest.requireActual('react');
return {
__esModule: true,
default: forwardRef((props: any, ref: any) => (
<div ref={ref}>{props.text}</div>
)),
};
});
describe('OwnershipCard', () => {
const groupEntity: GroupEntity = {
apiVersion: 'backstage.io/v1alpha1',
@@ -18,11 +18,6 @@ import React from 'react';
import { TechDocsSearchResultListItem } from './TechDocsSearchResultListItem';
import { renderInTestApp } from '@backstage/test-utils';
// Using canvas to render text..
jest.mock('react-text-truncate', () => {
return ({ text }: { text: string }) => <span>{text}</span>;
});
const validResult = {
location: 'https://backstage.io/docs',
title: 'Documentation',