Skip to content

Commit

Permalink
remove ref test for skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricevladimir committed Apr 16, 2024
1 parent 64a0d84 commit ab2139b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react';
import React from 'react';
import { StateSkeletonBar } from './stateSkeletonBar';
import { StateSkeletonBar, type IStateSkeletonBarProps } from './stateSkeletonBar';

describe('<StateSkeletonBar /> component', () => {
const createTestComponent = (props?: Partial<React.ComponentPropsWithRef<typeof StateSkeletonBar>>) => {
const createTestComponent = (props?: Partial<IStateSkeletonBarProps>) => {
const completeProps = { ...props };
return <StateSkeletonBar {...completeProps} />;
};
Expand All @@ -12,10 +11,4 @@ describe('<StateSkeletonBar /> component', () => {
render(createTestComponent());
expect(screen.getByTestId('stateSkeletonBar')).toBeInTheDocument();
});

it('forwards the ref to the skeleton element', () => {
const ref = React.createRef<HTMLDivElement>();
render(createTestComponent({ ref }));
expect(ref.current).toBe(screen.getByTestId('stateSkeletonBar'));
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react';
import React from 'react';
import { StateSkeletonCircular } from './stateSkeletonCircular';
import { StateSkeletonCircular, type IStateSkeletonCircularProps } from './stateSkeletonCircular';

describe('<StateSkeletonCircular /> component', () => {
const createTestComponent = (props?: Partial<React.ComponentPropsWithRef<typeof StateSkeletonCircular>>) => {
const createTestComponent = (props?: Partial<IStateSkeletonCircularProps>) => {
const completeProps = { ...props };
return <StateSkeletonCircular {...completeProps} />;
};
Expand All @@ -12,10 +11,4 @@ describe('<StateSkeletonCircular /> component', () => {
render(createTestComponent());
expect(screen.getByTestId('stateSkeletonCircular')).toBeInTheDocument();
});

it('forwards the ref to the skeleton element', () => {
const ref = React.createRef<HTMLDivElement>();
render(createTestComponent({ ref }));
expect(ref.current).toBe(screen.getByTestId('stateSkeletonCircular'));
});
});

0 comments on commit ab2139b

Please sign in to comment.